During the deployment of the Tag Manager script, you have to insert the subdomain you chose to use with Cookie Saver. What if you have multiple subdomains?
This guide explains how to add multiple subdomains to the custom Cookie Saver tag you created in Google Tag Manager.
If using multiple domains for your website, e.g. country-specific domains, it is important that all of them have subdomains created for the Cookie Saver service.
If Cookie Saver used the following domains:
- cookiesaver.com
- www.cookiesaver.com
- dk.cookiesaver.com
- uk.cookiesaver.com
Then the following subdomains should be created for the Cookie Saver service (note "fpc" can be anything that you choose):
- fpc.cookiesaver.com
- fpc.www.cookiesaver.com
- fpc.dk.cookiesaver.com
- fpc.uk.cookiesaver.com
This will allow Cookie Saver to save your cookies across all your domains.
The setup in Google Tag Manager (GTM) is straight forward. See the following steps.
Step 1
Add a new Variable with the following options:
- Variable Name: Cookie Saver - endpoint
- Variable Type: Lookup Table
- Input Variable: Page Hostname
Then add all your domains and related Cookie Saver subdomains as rows in Input.
Example:
Step 2
Use the created Variable for the endpoint in the Cookie Saver tag you have set up. It is referenced using {{Cookie Saver - endpoint}}
Example:
Example if configuring the script manually:
This will make GTM use the appropriate endpoint depending on the domain that the user is on.
Comments
0 comments
Please sign in to leave a comment.