Implementation of a cookie switch with the Google Tag Manager

Geschrieben von matthias

To prevent one and the same order from being tracked multiple times via different touchpoints and being assigned to all of them, there is a simple answer: the tracking switch, which assigns the sale to only one campaign. You can read more about how this works here in our blog post.

Furthermore, provides you with a free template for downloading, with which you can easily install a cookie switch based on the Google Tag Manager. There is also a video explaining this, which we have already summarised for you below:

1. log in to the Google Tag Manager and click on the Admin tab.

2. in the Admin section, click on Import Container, and there insert the template from The template will then upload all tags, triggers and variables. Please note that you must first click on Merge and select that the tags can be renamed. Then click on Continue. 3.

Now confirm the import: one tag, the three triggers and the 20 variables. 4.

Now the sourceCookie and the lastCookie variable are installed.

If, for example, a user first came to the website via AdWords, then via a newsletter and finally via Facebook, the sourceCookie now sets up the customer journey: AdWords/Newsletter/Facebook. The variable lastCookie then differentiates between the three possibilities and assigns the sale only to Facebook, as this was the last touchpoint. 5.

In the last step, refine your triggers so that they only trigger according to the desired model: In Google Tag Manager, click on Tags on the left column. There you will find a Facebook Conversion Tag, which is coupled with a Transaction Trigger. Then click on Transaction and directly, at the bottom right, on Copy. Now the new trigger is set up: Rename the trigger to Facebook Transaction. The event name remains the same. Now add a new filter: Select “lastCookie” in the first tab, “equals” in the second and “Facebook” in the third. Now confirm your selection by clicking on Create Trigger. 6.

Next, connect the trigger you have just set up to the tag. To do this, click on Tags in the Google Tag Manager on the left and select the Facebook Conversion Tag. Delete the existing transaction tag, by clicking the X. If you then go to “More”, you can easily select the newly set up Facebook transaction tag. Now save in the bottom left-hand corner. Any trigger can be set up and also assigned according to this principle, for example also for AdWords.

Now you have set up your switch and the trigger is triggered as desired and plays out data, in this case according to the Last Cookie Wins principle, only to the last touchpoint involved.