Home » Analytics » How to install Google Analytics using Google Tag Manager

How to install Google Analytics using Google Tag Manager

Analytics
Google Analytics, Google Tag Manager
4 minutos para leitura

In this article I will show you my preferred method for installing Google Analytics on a website. Learn how to install Google Analytics using Google Tag Manager.

When I wrote an article about how to install Google Analytics on WordPress using a plugin, many asked me if that was the only or the best way to implement GA. As I mentioned in that article, there are several ways to implement Google Analytics tracking code on a website, whether it is on WordPress or not.

In a hurry? Watch the video:

What is Google Analytics?

Google Analytics is the most popular and possibly the most complete web analytics tool on the market. It is a free Google tool (also available in a premium version with differentiated features) for analyzing the behavior of a site’s visitor.

It allows you to collect and analyze visitor browsing data providing valuable insights for your business and digital strategy.

With GA you can measure data such as number of visitors, page views, conversions, frequency and recency, sales, campaign results, events within the site, and much more.

Read also: Marketing Metrics: Partner Metrics

What is Google Tag Manager

Google Tag Manager (GTM) is a Google Tag Manager that aims to make the life of any developer, marketer or website owner easier.

Through GTM we can implement tags not only from Google Analytics but also from Facebook, Google Ads, other analytics tools, etc.

Installing Google Analytics using Google Tag Manager

To use this method we have to have GTM installed on our site. If you don’t already have it installed read the article“How to install Google Tag Manager on WordPress“. Even if your site is not in WP the reading is still valid and can help, since the concept for inserting GTM on the site is quite simple.

This is my favorite method! Not only for the ease but also for the possible customizations. Through this method you ensure that your implementation will not be lost after an unwanted update or configuration change on the site.

The tutorial below assumes that you already have an active Google Analytics account or know how to create one.

Tempo necessário para esta implementação: 5 minutes

How to install Google Analytics using Google Tag Manager

  1. Create a Google Tag Manager account

    Log into Google Tag Manager and create an account (if you already have an account skip this step).Criando uma conta no Google Tag Manager

  2. Install the GTM container on your website

    Add the necessary scripts to <head> and <body> of your site as directed when creating the container. This procedure may be different or aided by the use of plugins in some CMSs.
    Instalando o Google Tag Manager

  3. Setting up Google Analytics in the Google Tag Manager

    In your GTM container’s workspace, go to variables and click to add a new variable. Enter the tracking id of the property you want to monitor.Inserindo variável GA no GTM

  4. Triggering Google Analytics

    Register a pageview tag to be triggered on all pages of your site (or just the pages you want).Tag pageview Google Tag Manager

  5. Publish the changes in your GTM

    Click to publish the changes to your container. Publicando contêiner GTM

  6. Test your implementation

    Always test your implementations to make sure they are working and data is being collected correctly. To test this implementation, I suggest you use the preview mode of Google Tag Manager and also Google Analytics. Testando implementação GA via GTM

That’s it! Now your site has Google Analytics installed via Google Tag Manager.

It should be noted that the configuration presented in this tutorial is as basic as possible. Both the Google Analytics configuration and the pageview tag (and other tags) can be subject to numerous customizations according to your business interests.

Final considerations

Adding Google Analytics via Google Tag Manager is a quick and safe way to implement GA.

Using GTM it is possible to customize the GA configuration in countless ways, thus collecting data that can be used for the growth of your site, blog, or online store.

Continue reading: Analytics tools: 5 reasons not to use them

Continue reading: Digital Marketing Metrics: which ones are important?

Sobre o autor

Dicas gratuitas para otimizar o seu site!
  • Receba semanalmente dicas sobre SEO, analytics e WordPress.
  • Estratégias digitais e insights para melhorar suas conversões.