How to Retrieve UTM Data Using Google Tag Manager
Retrieving UTM data in Google Tag Manager involves a straightforward process to enhance tracking and analytics. Follow these steps:
- Persist Campaign Data Tag Template: Utilize the “Persist Campaign Data” custom Tag template in Google Tag Manager. This Tag is specifically designed to store UTM parameters in a browser cookie. Configure the Tag by specifying the desired UTM parameters and associate it with a trigger set to activate on all pages.
- Create a Form Field for UTM Parameter Capture: Use a form plugin such as Contact Form 7 in WordPress to create a form field dedicated to capturing UTM parameters. Integrate a new field into your form and designate it as a hidden field. This hidden field efficiently captures UTM parameters without affecting the user experience.
- Populate Form Field with Cookie Data: Populate the form field with cookie data in Google Tag Manager using a JavaScript code snippet within a custom HTML Tag. This code snippet retrieves the UTM parameters stored in the cookie and assigns them to the hidden form field. This automated process ensures that UTM parameters are seamlessly filled into the form upon user submission.
By following these steps, you can effectively retrieve and utilize UTM data in Google Tag Manager, enhancing your tracking capabilities and improving data accuracy for marketing campaigns.
Content updated March 2024.