Deploying Google Analytics

Google Tag Manager natively supports the configuration and deployment of Google Analytics.

In this article:

Using Google Analytics Settings Variables [New - May 2017]

Google Tag Manager offers a variable type called “Google Analytics Settings” for use in Universal Analytics tags in web and mobile (Firebase) containers. A Google Analytics Settings Variable acts as a central location to configure sets of Google Analytics settings for use across multiple tags.

When you create a Google Analytics tag using Universal Analytics for web, iOS (Firebase), or Android (Firebase), you will be prompted to select or create a new Google Analytics Settings Variable.

Most users will start off with a Google Analytics Settings Variable that contains just the Google Analytics tracking ID. Other more advanced configurations might include setting custom fields, using custom dimensions and metrics, or setting up cross domain tracking, and you can create more than one settings variable for different sets of settings. Learn more about tag configurations.

Overriding fields from a Google Analytics Settings Variable

When selecting a Google Analytics Settings Variable to use with your tag, you can override its settings on a per-tag basis. Use the checkbox labeled "Enable overriding settings in this tag" to modify any of the parameters in your Google Analytics Settings Variable for the given tag only. When this box is checked, you may enter a different Google Analytics tracking ID, or enable, disable, or modify any of the supported settings. For example: you might have a situation where you would like to have a Universal Analytics tag use all of the same settings that you’ve configured in a Google Analytics Settings Variable, but send the data to a different tracking ID.

If you find that you are consistently overriding the same settings in the same manner, you should consider creating a new Google Analytics Settings Variable to better support those settings and reduce redundancy.

Creating a new Google Analytics tag

To set up a new Google Analytics tag:

  1. On the Workspace Overview screen, click New Tag. Or from anywhere in your container, click Tags and then New. A new tag definition screen will appear.
  2. Click Tag Configuration and choose Universal Analytics.
  3. Select the desired Track Type. (For example, use Page View on a website to measure which pages your users visit. Use Event if you want to measure a specific interaction, such as a button click on a promotion.)
  4. Select or create a new Google Analytics Settings Variable:
    • To reuse a Google Analytics Settings Variable that has already been set up:
      1. Select the desired variable from the menu. Your Google Analytics Tracking ID and all other settings from that variable will be applied to your tag.
    • To set up a new Google Analytics Settings Variable:
      1. select New Variable….
      2. In the Variable Configuration screen, enter your Google Analytics Tracking ID.
      3. Cookie Domain: If you have no other Google Analytics tags deployed on your site via analytics.js or from Tag Manager, you should leave this value set to "auto". If you have other Google Analytics tags setup on your site or in Tag Manager, you should confirm that the Cookie Domain value is consistent.
      4. If you require additional settings such as setting custom fields, dimensions, metrics, content groups, display advertising features, Enhanced Ecommerce features, or cross domain tracking, click More Settings and configure the relevant fields.
      5. Click Save to save your tag.
      6. You will be prompted to rename the variable if you have not done so already. You may opt to choose to accept the default setting or enter a name of your own. Click Save to complete the tag setup.
  5. Click Triggering to choose a trigger that will make the tag fire. You may select an existing trigger, or click the + icon to define a new one.

Configuring Google Analytics Settings

All Google Analytics tags can be precisely configured within Google Tag Manager, offering most of the same configuration options as if you were manually implementing the Google Analytics tracking code on your site. (Note: custom Universal Analytics plugins are not currently supported in Google Tag Manager).

To configure your Google Analytics tags, you’ll need to enter a Tracking ID. Additional settings can be found in the More Settings menu:

Fields to set: If you're tagging with code-in-the-page (instead of Google Tag Manager), you would use the create() and set() API calls to establish trackers and add settings to them. Google Tag Manager handles this for you using Fields to Set. This option allows you to set fields not available in the tag templates.

Custom Dimensions: Learn more about using custom dimensions.

Custom Metrics: Learn more about using custom metrics.

Content Groups: Learn more about using content groups.

Display Advertising Features: enables features such as Demographics and Interest Reports, Remarketing with Google Analytics, and DCM Integration. Note that you must also configure the corresponding settings in the Google Analytics interface. Enabling the Display Advertising Features in your tags is optional, but may give you a minor performance improvement. Learn about Display Advertising features and their impact on your privacy policy.

Enhanced Ecommerce: enables sending data to measure various ecommerce-related interactions such as when customers have added items to their shopping carts, when they have started the checkout process, and when they have completed a purchase. You can also use Enhanced Ecommerce to identify segments of customers who are falling out of the shopping funnel. Learn more

Cross Domain Tracking: With cross domain tracking, you track separate, top-level domains as a single entity, thereby combining data for multiple top-level domains together in the same Google Analytics reports. Learn more about cross domain tracking.

  • Auto Link Domains: Use this field to supply a comma-separated list of domains to set up automatic cross-domain link tracking.
  • Use Hash As Delimiter: This setting allows you to use an octothorpe (#) instead of a question mark (?) to append cookie values to the cross domain tracking URLs. Use the menu to set this value to true, false, or to a Tag Manager variable that returns either true or false.
  • Decorate Forms: Adds tracking information to the form action. Use the menu to set this value to true, false, or to a Tag Manager variable that returns either true or false.

Advanced Configuration: These controls provide extended functionality and should be used by experienced users only.

  • Global Function Name: Renames the global function used by the Universal Analytics Tag. Learn more.
  • Use Debug Version: Google Analytics provides a debug version of the analytics.js library that logs detailed messages to the Javascript console as it is running. Use the menu to set this value to true, false, or to a Tag Manager variable that returns either true or false. Learn more
  • Enable Enhanced Link Attribution: Enhanced Link Attribution improves the accuracy of your In-Page Analytics report by automatically differentiating between multiple links to the same URL on a single page by using link element IDs. Use the menu to set this value to true, false, or to a Tag Manager variable that returns either true or false. Learn more
  • Set Tracker Name: Use of named trackers is highly discouraged in GTM. Learn More

Tag configurations

Once implemented, deploying Google Analytics tags from Google Tag Manager gives you the flexibility of deploying any variety of tag configuration without having to alter the source code of your website or app. Here are some examples of the possible tag configurations:

Basic web page tracking

Basic page tracking is the most common implementation for deploying Google Analytics from Google Tag Manager. Select “Page View” for your tag's track type. Add a trigger to fire the tag on all pages.

Track Google Analytics events

You can use Tag Manager to configure and deploy Google Analytics tags that will track specific events, such as clicks on links or buttons on a web page. Learn more

Track across domains

You can use Tag Manager to track users across multiple domains. Learn more

Ecommerce tracking

Learn more about ecommerce tracking, including how to implement Enhanced Ecommerce.

Dynamic remarketing

Learn how to implement dynamic remarketing using Google Analytics.

Next steps

Was this article helpful?
How can we improve it?