Menu

Do You Need Google Analytics?

If you care a bit about web analytics data, you need to implement a web analytics service on your website. Google provides the most famous and free analytics service, but how to set it and configure it on your website with regard of performance?

In this tutorial, I will give you the necessary steps to use Analytics using Google Tag Manager. Please keep in mind that this is a basic setup, I work with large accounts and GTM offers a ton of features to track and analyze websites and apps.

Prerequisites:

  • Google account (Gmail).
  • Access to the back-end of your Content Management System (CMS) or the HTML code of your website.

What are Google Analytics and Google Tag Manager

Google Analytics (GA, also known as GA4, its recent evolution) is a free web analytics platform that provides businesses and organizations with invaluable data about user behavior on websites and apps.

Google Tag Manager (GTM) is a Tag Management System (TMS) that allows for precise tracking of data points and integration with third-party applications.

Keep in mind that GA is the interface to analyze data regarding your website, GTM is a system to set up how and what you want to track more specifically.

The Performance Trick: Delay Firing Your Tags

When integrating GA or GTM, your website's speed will be marginally affected, potentially impacting its performance score on Google PageSpeed Insights. However, there's a clever workaround to boost your score using GTM's Timer trigger.

Google Tag Manager Performance

Google Tag Manager gives you the option to delay tags firing with the Timer trigger. Set to 2 seconds. I won’t recommend using the Scroll Depth trigger as you may miss Analytics data if user performs another action than scrolling.

Get Your Google Analytics ID

  1. Before configuring GTM, you need a Google Analytics ID. Go to Google Marketing Platform.
    Google Marketing Platform
  2. Sign in to continue with your Google account then follow the instructions: click on Get started, enter your organization name, etc.
    During the process, you have to decide whether or not you want to enable data sharing for Google products & services, Modeling contributions & business insights, Technical support, and Account specialists. It depends on your needs and resources, for a small website, I’ll recommend accepting.
  3. Enter a property name, you can have multiple property names under one account. In other terms, you can manage different websites (properties) under the same account. Select the reporting time zone and the Currency.
  4. Select the Industry category and the Business size, below in French (IT and Small).
    Google Analytics categorie et taille de l'entreprise
  5. Choose your business objectives, you can combine multiple objectives such as Generate leads and Drive online sales.
  6. After you accept the Terms of Service Agreement, you can choose a platform from where you will be collecting data (Web, Android app, or iOS app), Web in this case.
  7. Set up data stream, enter the website URL and the Stream name, click on Create stream (note the Measurement ID for later).
    Google Analytics Measurement ID
  8. You can install the Google Analytics tag on your website, with a website builder or CMS, or manually after the <head> element. We won’t do it now but later with GTM (next part).
    Google Analytics JavaScript Integration

If you use WordPress and don’t want to add the code manually, Google recommends using the extension MonsterInsights for Analytics, and GTM4WP if you use Google Tag Manager.

Install Google Tag Manager for Performance

Using Google Tag Manager offers more possibilities for tracking your website or app. GTM uses a container that you can fill up with whatever tags, scripts, code snippets you need depending on what data you want to track, from your website and other platforms: LinkedIn, Pinterest, Google Ads, etc.

Once you have selected the Tag Manager product from the Marketing Platform, you want to create your tags.
Google Tag Manager Homepage

  • The first tag to create is to establish a connection with Google Analytics: GA4 Event.
    Google Tag Manager Google Analytics: GA4 Event
  • Make sure your Google Analytics ID (Measurement ID) is there, enter “click” for the Event Name and set a name for this Tag.
    Google Analytics ID
  • In Event Parameters, you need to select 2 events (click on the bricks to open the built-in variable library):
    ● link_url with the Value {{Click URL}}
    ● link_text with the Value {{Click Text}}
    Tag Manager Event Parameter
  • Add the trigger: select the “Just Links” trigger type then select “All Link Clicks” if you want to track all your links.
    Google Tag Trigger All Link Clicks

The second tag you want to create is to delay the loading of your GTM to improve the performance score of your website! (using Google PageSpeed Insights)

  • Create a Tag, ensure the Measurement ID is there, under the Configuration settings, you can use the bricks to set the “send_page_view” on “true”.
    Google Tag Manager Send Page View
  • Then you want to add the trigger, a timer to delay the loading of the Google Tag. Select “Timer” from the trigger type list.
    Google Tag Manager Send Page View
  • Set the Interval on 2000 milliseconds, it is enough. Limit on 1, and regarding the conditions, it’s an Event that contains “Pageview”. Finally, set this trigger fires on “All Timers”.
    Google Tag Manager Timer trigger

Optional and to give you another example, a simple tag to configure could be the “Scroll Depth” (as your trigger type), to see if users are scrolling down on your pages.
Google Tag Manager Scroll Depth
With the Event Parameter set on “percent_scrolled”, the Value “Scroll Depth Threshold”), you can set the Trigger with different values such as 10,25,50,75,90 percent.
Feel free to reach out if you'd like further guidance on tag configurations and best practices.

Don’t forget to install Google Tag Manager on your website, using the script. You don’t need to keep both your Google Analytics and GTM scripts, only GTM is needed, except if you are using GA only as mentioned before.
Install Google Tag Manager Script

After setting up your tags, it's crucial to preview and then submit your changes.
Tag Manager review your tags

Connect your website and verify tag triggering by clicking on links and scrolling down.
Tag Manager Connect Tag Assistant

Did they fire? Did they work? Great, click on Publish and you’re all set, wait a few days and connect to your Google Analytics dashboard to start analyzing the traffic of your website or App.

Continuing Your Journey with Google Tag Manager

Congratulations! You've now successfully implemented Google Analytics with Google Tag Manager, enhancing your website's performance and unlocking powerful insights into visitor behavior.

By following these steps, you've optimized your setup for efficient tracking without compromising site speed.

Remember, this is just the beginning of your journey! Google Tag Manager enables seamless integration of third-party applications, while Google Analytics provides the interface for in-depth analysis. With this combination, you're equipped to make data-driven decisions that drive your online success. In larger projects, we utilize additional tools like BigQuery and Looker.

If you have any questions or want to delve deeper into tag configurations and best practices, feel free to reach out below. Happy tracking!

icon up to top of the website