Define custom rules using filters
Filters let you define rules for a variety of actions including which conversions are reported.
Filters are custom fields you can create and set in your registration header. Filters are flexible and have more uses than we will cover here, but here are just two ways they can be useful:
- Only count conversions for a specific product category, and filter out conversions for other categories.
- Choose trigger data based on source event data because for event-level reports, the bit limit for the trigger data is different depending on the source type—ad click (0-7) or view (0 or 1). It can be convenient to dynamically assign the value of the trigger data depending on the source type.
How to declare filters
On source registration, add a filter_data
field to the Attribution-Reporting-Register-Source
header.
On trigger registration, add a filters
field to the Attribution-Reporting-Register-Trigger
header.
Example code
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-03-01 UTC.
[null,null,["Last updated 2022-03-01 UTC."],[[["Filters can be defined to specify which conversions are included in reports, allowing for granular control over attribution data."],["Filters are declared using custom fields within the registration header for both source and trigger events."],["By leveraging filters, advertisers can isolate conversions for specific product categories or tailor trigger data based on the source event type."],["Filters enhance flexibility in attribution reporting by enabling dynamic data selection and refined conversion tracking."]]],["Filters enable custom rule definitions for actions, including conversion reporting. They are set in registration headers via `filter_data` (source) and `filters` (trigger) fields. Key actions include: limiting conversions to a specific product category by filtering out others, and dynamically assigning trigger data values based on the source type (ad click or view) due to differing bit limits. These are defined on both the source and trigger side.\n"]]