The Adform Cookie Retrieval Script tag retrieves the Adform cookie ID (adfuid) from the user’s browser and stores it as a first-party cookie, so it can be reused client-side and passed along in server-side requests.
How It Works
When the tag fires, it looks for the Adform cookie ID in the following order and stops as soon as a valid one is found:
- URL / referrer parameter - checks the current page URL and the referrer URL for an
adfcookieidquery parameter. - Existing first-party cookie - checks whether an
adfuidcookie is already set in the browser. - Adform’s serving script - injects Adform’s cookie serving script (
track.adform.net/Serving/Cookie) and reads the ID it assigns towindow.Adform._uid. Most useful for view-throught conversions, when the Adform Tag for sGTM cannot capture the Cookie ID.
Whichever value is found first is validated and stored in the adfuid first-party cookie using the domain, SameSite, and expiration settings configured on the tag.
Setup Instructions
- Import the template from the Community Template Gallery or manually using the template.tpl file into your GTM Web workspace.
- Create a new tag using the Adform Cookie Retrieval Script template.
- Configure the Cookie Settings (optional):
- Cookie Domain - the domain the
adfuidcookie is written to. Defaults toauto, letting the browser determine it. - Cookie SameSite - the
SameSiteattribute for theadfuidcookie. Defaults toNone. - Cookie Expiration - how long, in days, the
adfuidcookie is kept. Defaults to60.
- Cookie Domain - the domain the
- Assign a trigger that fires on page load (Container Initialization, All Pages, DOM Ready). Make sure to adhere to your consent management.
Useful Resources
- Adform tag for server-side Google Tag Manager - use the
adfuidcookie captured by this tag as input for Adform’s server-side tracking.
Open Source
The Adform Cookie Retrieval Script tag for Google Tag Manager Web is developed and maintained by Stape Team under the Apache 2.0 license.
GTM Gallery Status
Not listed