UPDATE: We recently created a Cookie Saver GTM Tag Template that we recommend using when implementing through GTM.
See more here: Cookie Saver GTM Tag Template
Cookie Saver can easily be deployed and managed on your site through Google Tag Manager. This is done through the following steps.
- Implement the Cookie Saver Preload script
- Create a new Google Tag Manager tag
- Configure, add cookies and deploy
It is assumed that an existing Google Tag Manager implementation is in place on the website and configured as required: https://support.google.com/tagmanager/answer/6103696?hl=en
1. Implement Preload script
The Preload script is used to guarantee that your cookies are always up-to-date when the page loads. More information and implementation instructions can be found under Preload script implementation
2. Create Google Tag Manager tag
Once logged into your GTM container, create a new HTML tag by clicking "Tags" > "New" > "Custom HTML".
Give the tag a name, e.g. "Cookie Saver".
In the "HTML" field, insert the Cookie Saver code that can be copied from your Cookie Saver account. See Cookie Saver scripts
Select "All Pages" as the trigger and click "Save" to create the tag.
This is what the configuration should look like (except for the cookies that will be added in the next step).
3. Configure, add cookies and deploy
Before adding cookies, Cookie Saver should be configured to your domain. More information can be found here.
In most cases, the following will suffice:
acq("init", { "endpoint": "INSERT ENDPOINT" });
Where
- "endpoint" is the CNAME domain that you have chosen to use with Cookie Saver (e.g. for cookiesaver.io we have chosen to use fpc.cookiesaver.io).
Cookies are added one-by-one. In most cases it is enough by adding a name and the wanted expiration days.
acq("addCookie", { "name": "INSERT COOKIE NAME", "expirationDays": INSERT EXPIRATION DAYS });
Where
- "name" is the exact cookie name (e.g. for Google Analytics its "_ga")
- "expirationDays" is the wanted expiration in days, (e.g. for Google Analytics its two years, equal to 730 days)
More information about the different configuration possibilities when adding cookies can be seen here Add cookies to save them
After you have added the cookies that should be saved, Cookie Saver should be started by adding the following:
acq("start");
This is what a complete configuration can look like when including cookies for Google Analytics (_ga), Adobe Analytics (AMCD_DE7...), Facebook (_fbp, _fbc) and our Cookie Consent.
See also our post How to see your Cookie Saver setup is working
Comments
0 comments
Please sign in to leave a comment.