Step By Step Guide to Set up Google Analytics through Google Tag Manager

Measuring and understanding visitor behavior on your own website, in the online shop or in the app is an important prerequisite for targeting optimization measures and monitoring their success. With Google Analytics, Google offers a freely usable and easy-to-use tool. For an error-free analysis, however, complete implementation and important basic settings are necessary. With the help of a second tool, Google Tag Manager, this is not a problem.

Google Tag Manager

In this post, I will show you step by step how to install Google Analytics on your website via Google Tag Manager and which settings have to be made to record an important part of visitor behavior – page views. Already in this basic implementation, Google Analytics offers a variety of evaluation options with which you can answer key questions:

  • Target group: Who visits my website?
  • Acquisition: How do visitors get to my website?
  • Behavior: What are the visitors doing on my website?

In addition, the use of Google Analytics with the Google Tag Manager forms the basis for an uncomplicated expansion of the analysis options. But why is the evaluation of user behavior on my website so important?

Why should I evaluate user behavior on my website?

Imagine you want to renovate your house and bring it up to date. In most cases, you and the people living in it will first collect the points you want to improve and collect ideas for changes. Then you can obtain estimates and offers from the required trades and compare prices.

While carrying out the construction work, you regularly check the progress of the work and whether it complies with the agreed plans. After completing the renovation, also check whether the end result meets your expectations and the desired improvements in the living experience occur.

Inspiration and success control play an important role in the renovation of a house. The situation is similar to the optimization of websites. Without knowledge of the status quo, it is difficult to define goals and develop measures based on them. Without measuring the optimization process, the effect of the measures cannot be assessed and countermeasures cannot be counteracted.

And without a final success check, the efficiency and effectiveness of the measures taken cannot be assessed and no conclusions can be drawn for future projects.

Blind flying should, therefore, be strictly avoided here. Because similar to building a house, errors in website optimization can cost a lot of money, time and nerves. Web Analytics can counteract this by providing number-based information on user behavior on its own website and thus making an important contribution both to the identification of optimization potential and to success monitoring.

Why should I set up Google Analytics?

Google Analytics can be used to get started with web analytics. It is a free tool for analyzing the flow of visitors on your own website, online shop or in your own app. For small and medium-sized companies, in particular, it offers many advantages:

  • The basic (and for most use cases sufficient) version of Google Analytics is free. This means that neither initial nor running costs arise from using the tool.
  • Especially in combination with the Google Tag Manager, Google Analytics is easy to implement and easy to use. Only minimal changes to the website code are necessary to integrate the Google Tag Manager. Further adjustments can be made conveniently in the user interface of the tool.
  • As part of the Google product family, the expertise of the search engine market leader flows into the constant further development of the tool. In addition, the integration of other important Google services is ensured, which means, for example, that data from Google Ads can be evaluated in much greater detail together with the data from Google Analytics.

Optimal implementation of Google Analytics with the Google Tag Manager

In order to record and evaluate the flow of visitors to your own website with Google Analytics, a so-called tracking code (“tag”) must be installed in the source text of the website. This is a JavaScript code that is executed each time the website is accessed and sends data about user activity to Google Analytics.

There are two ways to embed the tracking code for Google Analytics on the website:

  • Direct integration of the current code version into the page source text and manual tagging of relevant interaction elements (e.g. click on buttons/links) by adding appropriate lines of code to each element.
  • Integration via the Google Tag Manager, which serves as a container for Google Analytics (and other services) and all other settings can be made via its graphical user interface.

In order to ensure a future-proof solution that is as simple and easy to use as possible, we recommend the integration of Google Analytics via the Google Tag Manager. This has the advantage, among other things, that only the initial integration of the code in the source text of the website needs to be intervened. All other adjustments such as setting up events to track visitor interaction with important page elements or updating the tracking code from Google Analytics can then be carried out directly in Google Tag Manager without the help of programmers.

Google Tag Manager set up


In order for Google Analytics to be installed on the website via the Google Tag Manager, the Google Tag Manager must first be set up. A free Google account is required to use both services, which then also gives access to other Google products (e.g. Gmail, Google Calendar).

The Tag Manager account is set up on the Google Tag Manager website.

Basic setup

Google Tag Manager works with three key elements:

  • Tags: The code to be executed on the website (e.g. the tracking code for Google Analytics to record page views).
  • Trigger: The condition of where and when the code of the tag should be executed (e.g. on all pages or only on certain pages of the website).
  • Variables: Placeholders for storing information that can be used to control triggers and tags (e.g. frequently used values ??such as the Google Analytics ID).

Conclusion and outlook

Recording and evaluating page views with Google Analytics is an important step. It enables us to understand the behavior of our website visitors fundamentally and to derive initial optimization measures from them. However, modern websites offer far more interaction options than just navigating from page to page.

Important elements are, for example:

  • Clicks on buttons and links,
  • Subscribe to the newsletter,
  • File downloads,
  • Playing videos,
  • Sending contact forms,
  • Product interactions such as product views, adding to and deleting products from the shopping cart,
  • Placing orders.

With the implementation of Google Analytics via Google Tag Manager, we have created the basis to set up such events and e-commerce interactions quickly and conveniently and to expand our existing tracking. Individual reports and dashboards in Google Analytics and / or the merging with other data sources in Google Data Studio can be used to gain important insights that can serve both as a basis for optimization measures and for their success monitoring.

However, it is important to avoid excess information. The principle should be to only collect information from which analysis relevant conclusions can be drawn. Tracking “because it works” has never been a good idea and only leads to getting lost in the dashboard and reporting views and blocking the view of the actually relevant information.

Spread the love

Article Author Details

Rosie Harman

Rosie Harman has 10 years of experience in the field of Information Technology. Currently she is working for contour tv and writing Pet Blogs.