Quickstart overview
The Tag Manager Quickstart container includes support for best practices and helpful recommendations to common requirements.
Container highlights
- Universal Analytics pageviews
- Subdomain tracking
- Cross domain tracking
- Event Tracking
- Scroll Tracking
- Outbound link tracking
- Form submission tracking
- Client Id tracking
- Content Grouping
- Cross domain iframe tracking
- Helper functions for other types of event tracking including
- manual/auto event tracking
- social event tracking
- virtual pageview tracking
Follow the steps below to deploy the Tag Manager Quickstart container. This article assumes that you have created your own Tag Manager account and container.
Download the quickstart configuration file
Download Tag Manager quickstart configuration
Import container configuration file
Import the container file into your Tag Manager container. If your Tag Manager container already has existing configurations, you can opt to merge the import into your existing container -- if so, you should remove any duplicate Analytics tags from your existing container.
Adjust Tag Manager container variables
The following variables have been provided in the Tag Manager configuration file and require personalized adjustment. You will find them in your container with names preceded by 0_
, 1_
, or 2_
. It is recommended that you rename them without this prefix once you have edited them.
Analytics settings
Ensure that the settings variable used in the configuration file is compatible with any settings used by your existing container.
Analytics property
It is required to place your Google Analytics property id into the 0_GA property
constant variable with the Tag Manager container.
In the case where your Tag Manager container manages multiple Google Analytics properties, edit the 2_GA property table
variable to map the input domains to the output GA properties. In this case, replace all instances of the 0_GA property
variable with the 2_GA property table
variable.
cross domains
To implement cross-domain tracking, append all domains across which traffic should be joined to the variable 1_GA cross domains
, as well as to the referral exclusion list in the Analytics admin interface.
In the case where your list of cross domains is too large for the Tag Manager constant variable type, add your domain list to the domains
variable within the javascript of the 2_GA cross domains array
Tag Manager JavaScript variable. In this case, replace all instances of the 1_GA cross domains
variable with the 2_GA cross domains array
variable.
GA index - cd - client ID
1_GA index - cd - client ID
Tag Manager variable with the index of your client Id custom dimension. If this dimension does not exist, you must create it as a user-scoped custom dimension.GA index - cg - page type
1_GA index - cg - page type
GTM variable with the index of your page type content group. If it does not exist in Google Analytics, you must create the content group.Deploy the data layer & container code
In order to make use of the quickstart container, you must deploy a data layer and the Tag Manager code snippet on all pages of your site. The data layer should be included in the
of your page, while the container snippet should be added at the top of the
section. Ensure that you replace GTM-XXXX
with your own container id.
<!-- * header contents * -->
<!-- Google Tag Manager Data Layer -->
<script>
analyticsEvent = function() {};
analyticsSocial = function() {};
analyticsVPV = function() {};
analyticsForm = function() {};
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'pageType': pageType // <-- this variable must hold a page type content grouping
});
</script>
<!-- End Google Tag Manager Data Layer -->
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXX');</script>
<!-- End Google Tag Manager -->
<!-- * additional header contents * -->
</head>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript>
<iframe src='https://www.googletagmanager.com/ns.html?id=GTM-XXXX'
height='0' width='0' style='display:none;visibility:hidden'></iframe>
</noscript>
<!-- End Google Tag Manager (noscript) -->
Test & Publish
Test the container (preferably on a non-production environment) to ensure that it functions as expected and does not impact any of your site's functionality (it is recommended to use the Chrome extension for tag injection for testing containers).
Publish the container to see the changes go live.