Prioritize specific clicks, views, or conversions

Configure the API to prioritize specific sources or triggers.

Published on Updated on

Prioritize specific clicks or views for event-level or aggregatable reports

Using source-side priorities, you can change the Attribution Reporting API's default behavior. By default, the attribution model is last-touch, meaning that a conversion is attributed to the most recent matching source event. For both event-level and aggregatable reports you can tweak this behavior.

To change the default priority, add the priority key to your source registration header.

Set a higher priority for sources you wish to prioritize. Larger values denote a higher priority; for example, a source event with a priority of 2 takes precedence over a source with a priority of 1.

Only the report that matches the source event with the highest priority is sent.

Example code

Change the attribution to select less recent sources (first click):

const currentTimestamp = Date.now();
const priority = - currentTimestamp;

res.set(
'Attribution-Reporting-Register-Source',
JSON.stringify({
// … all usual fields for that header
priority: `${priority}`
})
);

Prioritize specific conversions for event-level reports

Unlike source-side priorities, setting trigger-side priorities is only available for event-level reports.

Assume that a user clicks an ad and converts four times: they visit the advertiser site homepage, then visit a product page, sign up to the newsletter, and finally make a purchase.

But due to the three-report limit for clicks, by default all subsequent reports after the signup (third conversion) are dropped, including the purchase report.

Instead, you can configure the API such that you receive reports for conversions that you consider more important; for example, the purchase report.

To do so, add the priority key to your trigger registration header and set a higher priority for conversions you want to prioritize.

When an attribution is triggered for a given source event, if the maximum number of attributions (three for clicks, one for views) has been reached for this source the browser will:

  • Compare the priority of the new report with the priorities of existing scheduled reports for that same source.

  • Delete the report with the lowest priority to schedule the new report instead. If the new report is the one with the lowest priority, it is ignored and you won't receive it.

If no priorities are set, the browser falls back to its default behavior: any conversion happening after the third conversion for clicks or the first conversion for views is dropped.

Review the example code: prioritize conversions of type checkout

Next steps

For information about setting sources and triggers, refer to:

Updated on Improve article

This site uses cookies to deliver and enhance the quality of its services and to analyze traffic. If you agree, cookies are also used to serve advertising and to personalize the content and advertisements that you see. Learn more about our use of cookies.