If you include external services in your web project to measure its success or the number of ad­ver­tis­ing campaigns launched, you usually need to juggle a large number of snippet codes. In addition to a certain know-how in pro­gram­ming, this requires a high degree of oversight. Without the ability to directly access the code base, you would always need to contact the re­spon­si­ble pro­gram­mer to implement new analytics and tracking services. In an effort to counter this, Google published the Google Tag Manager a few years ago, which sim­pli­fies the in­te­gra­tion of different codes con­sid­er­ably.

What is Google Tag Manager?

In October 2012, Google released the Google Tag Manager (GTM) as its in-house man­age­ment system for the in­te­gra­tion and man­age­ment of JavaScript - and HTML - tags. While the first version was primarily designed for Google’s Analytics, AdWords, and Dou­bleClick solutions, version 2 (2014) of the Tag Manager has been sup­port­ing an ever-in­creas­ing number of third-party tags, es­pe­cial­ly with the release of the official API. Google Tag Manager is not limited to just im­ple­ment­ing analysis and con­ver­sion tool: re­mar­ket­ing and affiliate tags as well as snippets from testing tools, such as AB Tasty or Mouseflow (heat mapping tool), can be im­ple­ment­ed into a web project (website or mobile app) using the software.

Note

For a list of of­fi­cial­ly supported tags, visit the Google Support Forum.

How exactly does the Google Tag Manager work?

When using Google Tag Manager, you cannot com­plete­ly avoid in­ter­act­ing with the source code. However, unlike snippet in­te­gra­tion without the Tag Manager, you only need to interact with the HTML framework once. To start, insert the container snippet in the form of two small code sections in the header and body area. All the other im­ple­men­ta­tions are done in the terminal via the Google Tag Manager interface. The container snippet acts as a central place from which all tags that you configure through the browser are collected. Later changes to a snippet can be made directly in the Tag Manager. Should you no longer need a tag, simply delete it from the container.

Tags, triggers, and variables: the core com­po­nents of Google Tag Manager

To ensure the container snippet detects the desired user in­ter­ac­tions and in­for­ma­tion, and that it is then forwarded to the re­spec­tive service, you must ensure that you create the correct tags and triggers in Google Tag Manager. Variables can be used to specify both these basic elements of the Google tools. For all three com­po­nents, there are precast templates – you can also adjust these to your needs in the settings. The exact functions of the tag, trigger, and variable are shown in the following short briefs.

Tags

Tags are the central con­trol­ling units of the Google Tag Manager. They determine what in­for­ma­tion is sent to which services and are in code form. In principle, tags are nothing more than the snippets you would include in the HTML code. In addition to the standard tags, there are special JavaScript tags that do not serve to pass in­for­ma­tion but trigger ad­di­tion­al tags. However, the Google Tag Manager generally loads all tags contained within a container in­de­pen­dent­ly of each other and in parallel to the other elements of the web project. Through an in­tel­li­gent caching mechanism, the number of requests that the webserver must deal with is optimized.

Tip

With the tag blacklist you can also define tags or tag types that your website or app should never include.

Trigger

Triggers let you define the re­quire­ments under which a specific tag is used in Google Tag Manager. Specif­i­cal­ly, it is about which user actions or events lead to a code being performed – and so "trig­ger­ing" it. These can be, for example, simple page views, loaded windows or the ap­pear­ance of error messages, but also active clicks of visitors to a par­tic­u­lar button. You can, of course, also fill out a form, sign up to a newslet­ter, or watch a video as a tag trigger. It is possible to use the same trigger for multiple tags.

Variables

If you want to change the settings for defined tags and triggers, you can use the Tag Manager variables. For tags, variables provide the ability to capture dynamic values. If, for example, in­for­ma­tion such as the handover of the trans­ac­tion or the handover of the purchased products is to be tracked in an online shop, variables can be regulated. Triggers behave in a similar way - variables are used to specify the triggers: while you only use a trigger to define that a tag should be executed when a page im­pres­sion occurs, you can use a variable to specify which page(s) or URL(s) should be involved.

Snippets im­ple­ment­ed with Google Tag Manager – the benefits

The Google Tag Manager operates on a diverse base of areas for every event, working with in­te­grat­ed tracking and analysis tools. We have collected the ad­van­tages of this Google software:

  • In­ter­me­di­ate storage of tags minimizes server re­quire­ments and reduces the loading time of web projects.
  • General stream­lin­ing of source codes
  • Simple, con­ve­nient in­te­gra­tion and man­age­ment of tags using a dedicated web interface after one direct in­ter­ac­tion with the source code
  • Permanent blocking of undesired snippets and snippet types enhances the security standards of your website/app.
  • Diverse ready-to-use templates for tags, variables, and triggers available
  • Automatic ver­i­fi­ca­tion of tags in the preview and debugging modes
  • Recording of all tag ac­tiv­i­ties, such as changes to the Google Tag Manager account settings

Tutorial: using Google Tag Manager for your own web project

How can Google’s Tag Manager be used for your own website or app? Since the Tag Manager is web-based, no in­stal­la­tion is necessary and you can access the interface via any standard browser. Also, there are no costs involved to use the tool, so in principle you can start im­me­di­ate­ly. Indeed, the only re­quire­ment is a valid Google account. If you already use services such as AdWords, Gmail, or Google Drive, you already have an account - otherwise you will need to create an account to access Google Tag Manager.

Step 1: set up a Google Tag Manager account

Go to the Tag Manager from Google homepage and log in with your Google account to begin setting up. A new menu will open au­to­mat­i­cal­ly, through which you can add your Tag Manager account. Enter your desired account name and country of residence. Click the “Continue” button to confirm the data entered.

Step 2: container setup

The next step is to set up the container in which you will later insert the snippets of your choice. Choose a name for it - for a website it is sensible to use the URL, es­pe­cial­ly if you plan on managing multiple different projects (each with their own con­tain­ers) through your Tag Manager account. To complete the container creation, specify the type of project (default website, AMP, or app) and click “Create.”

Step 3: integrate the Google Tag Manager container snippet

It takes a brief moment for the Google tool to generate the container. If the setup was suc­cess­ful, the Tag Manager will present the two-parts of the container snippet. The first part of the code you then copy and paste into the header of your page, and the latter you should put in the body area of the desired HTML document (directly after the opening body tag). This ensures the snippet will be loaded as early as possible, and the most accurate mea­sure­ment data is delivered.

Tip

The Google Tag Manager code can be viewed at any time after. To do so, simply go to the tab “Manage” and click on “Google Tag Manager install.”

Step 4: adding tags

Once you have in­te­grat­ed the Tag Manager code, you can begin filling the container. The first step is to create tags to implement the actual tracking and analysis codes in your website or app. We will use the well-known Google Analytics as an example. Simply find your work area via the tab of the same name and select “new tab” or “add new tab.

Click on the “Tag con­fig­u­ra­tion” field and select the tag type “universal analytics”:

Determine what analytics should be tracked (in this tutorial: page view) and check the option “Enable over­rid­ing settings in this tag” (required if there is no variable added). You can then enter the analytics tracking ID in the cor­re­spond­ing field. To use Google Analytics in ac­cor­dance with data pro­tec­tion laws, add the field name "anonymizeIp" under "More Settings" -> “Fields to set” and set the value to "true." As a result, the IP addresses recorded by your web server are forwarded anony­mous­ly to Google.

Save the new Google Analytics tag on the same-named button and in the pop-up window “Save tag.” You can then takeover the suggested tag names.

Step 5: add trigger

Once you have saved the tags in Google Tag Manager, you will be prompted to add a trigger to use the tracking code from analytics for the desired user-action. To create a new trigger, select “Trigger” in the menu list and click on “New.

Click on the “Trigger con­fig­u­ra­tion” field to get an overview of the available trigger types. Look for your desired trigger and click on the cor­re­spond­ing entry. If you have a trigger event for which no template exists, select “Custom Event.” In this Google Tag Manager tutorial, we will take the trigger “Page View” that was used as the tracking target in the previous step. This type can also be set to apply to all or only specific cues.

Press “Save” and choose an ap­pro­pri­ate name for the new trigger.

Step 6: connect trigger and tag

Go back to the tag created in step 4 (found under “Tags”) and connect the trigger by selecting the “Trigger” button, selecting one from the pop-up list, and save changes.

Step 7: test the func­tion­al­i­ty of the tags

Google Tag Manager gives you the ability to test the func­tion­al­i­ty of the connected tags and trigger before you make the live change in the snippet container. To do this, click on “see in preview mode.” After a short wait the following message will appear, informing you that the Tag Manager’s preview mode is active.

If you have started the preview mode, open your web project in a new tab. At the bottom edge of the screen, Google’s Tag Manager console will open and you will see in the “Summary” section which tags have been executed. Since we have con­fig­ured it so that Google Analytics should be played directly from the page view in this tutorial, the console lists the tag as “tags fired on this page.”

Note

To test tags or triggers that need specific user-in­ter­ac­tion, for example clicking a button, you must first perform the ap­pro­pri­ate action.

Step 8: publish container

With your container set up as you require, it is time to integrate it into your live web project. This requires creating a new version and pub­lish­ing it. Click on the “SUBMIT” button, which can be found in the top right-hand corner, select “Publish and Create Version,” and give the container a name and de­scrip­tion (optional), which is es­pe­cial­ly rec­om­mend­ed for large tag col­lec­tions.

Click on “Publish” to complete the live version of your first tag container.

Go to Main Menu