Creating a Google Analytics Settings Variable with Google Tag Manager
The Google Analytics Settings variable is used in Universal Analytics tags for web and mobile (Firebase) containers to centrally configure and share common Google Analytics settings across multiple tags. When you create a Universal Analytics tag, Google Tag Manager will prompt you to select or create a Google Analytics Settings variable.
Create a Google Analytics settings variable
To create a new Google Analytics Settings variable:
- Click Variables.
- Under the User-Defined Variables heading, click New.
- Click Variable Configuration and select Google Analytics Settings (located under the Utilities heading).
- Enter your Google Analytics ID in the Tracking ID field.
- For most implementations, leave "Cookie Domain" set to auto.
- Save the tag.
How to find the Google Analytics ID
To find the Google Analytics ID:
- Sign in to your Analytics account.
- Click Admin.
- Select an account from the menu in the ACCOUNT column.
- Select a property from the menu in the PROPERTY column.
- Under PROPERTY, click Tracking Info > Tracking Code. Your ID is displayed at the top of the page.
The Cookie Domain field
If you already have Universal Analytics tags setup in Tag Manager or on your site, you should make sure the cookie domain is named consistently across those tags. The default value for the Cookie Domain field is "auto", which enables Google Analytics to automatically determine the best cookie domain to use. For most implementations, there is no need to modify this setting. Only adjust the value if you have a specific need to do so. Learn more.
Most users will start off with a Google Analytics Settings variable that contains only a Google Analytics ID. Any additional tag configurations that use that same Google Analytics ID will then be able to leverage the variable, without having to re-enter the ID. Advanced configurations might include custom fields, custom dimensions, custom metrics, or cross domain measurement, and these settings would be shared by any tag that uses this variable. You can create as many Google Analytics Settings variables as needed, each with their own custom settings that need to be shared across a group of similar tags.
You can override the functionality of a Google Analytics Settings variable on a per-tag basis. Use Enable overriding settings in this tag to modify any of the parameters for the given tag.