UTMZ Cookie Replicator for GTM

December 18, 2017
By Bounteous

This recipe will automatically attempt to determine a visitor’s referring traffic information, creating information about their sourcemediumcampaigncontent, and term – as well as gclid and dclid.

This works to replace the information that was previously stored in the __utmz cookie when using the traditional Google Analytics implementation.

This information can then be used with other Tags and Triggers – passed to a hidden form fields, used to fire specific tags, and shared with other tools.

Instructions

1. Download Container File

Download the container JSON file.

(You may need to right-click on the link and choose “Save Link As” or “Save Target As” to save the JSON file to your computer.)

 

2. Import JSON File into GTM

Log into your own Google Tag Manager container and head to the Admin section of the site. Under Container options, select Import Container. Check out this blog post for more details about importing a container file.

 

4. Preview & Publish

Use the Preview options to test this container on your own site. Try testing each of the events to make sure they’re working properly. If everything looks good, go ahead and publish!

 

Optional - Add To Other Tags

By itself, this recipe does not make any visible changes. The recipe works to make a visitor’s traffic information available for you to use in GTM. Now comes the fun part!

You can use this information to populate a hidden form field on a contact form, send this information to another platform, and use this information to fire specific tags.

 

Ingredients

Tags (1)

CU - __utmz Cookie Replicator

    Variables (13)

    CK - __utmz

    CK - __utmzz

    CK - __utmzzses

    JS - Extract __utmzz Cookie Values

    JS - GA Campaign

    JS - GA Content

    JS - GA Keyword

    JS - GA Medium

    JS - GA Source

    JS - Page Domain

    JS - Referrer Domain

    Page Fragment

    Page Query String

    Right-click & Save File As to Download