SEO Glossary > Google Analytics Tracking Code

Google Analytics Tracking Code

Google Analytics Tracking Code, also known as GA Tracking Code, is a small snippet of code provided by Google Analytics that is added to a website's HTML.

This code allows you to track your user activity on your site and gather data on:
  • User behavior
  • Engagement

Once the code is added to your website, it collects information about your site's visitors, including which pages they visit, how long they spend on each page, and where they come from (i.e., geographic location, referral source, etc.).

This data is then sent to Google Analytics servers, where it is processed and analyzed to provide you with insights into how your site is performing and how it can be improved.

Where can you find Google Analytics tracking code? 

First, log into your Google Analytics account and click on the admin gear icon to find your Google Analytics tracking code.

Google Analytics Admin buttonj

Once there, click on the Data Streams icon.

Data Stream button in the Admin page

Pick the website you want to add the code to and scroll down to the tab marked Google Tag.

Tab showing Google Tag information

Then click on View Tag Instructions tab and you’ll find the tracking code. To copy the code, click the copy button on the top right-hand corner of the code snippet.

Google Analytics tracking code

Once you have your code snippet, the next step is to add it to your site.

Where do I put Google Analytics code? 

Once you’ve copied the code you are ready to add it to your site. You add it to your site by pasting it into the HTML code of your site, just before the closing </head>  tag.

The exact location of the tracking code will depend on the platform or content management system you are using.

If you are using a website builder or CMS, there may be a specific field where you can paste the tracking code, or you may need to edit your website's code manually.

Once you’ve added the code to your website, Google Analytics will track your website's traffic and provide you with valuable insights into your website's performance.

How do I add Google Analytics tracking code to Google Tag Manager? 

Google Analytics tracking code should not be added through Google Tag Manager, and Google Measurement ID should be added instead.

To do that, go to your Google Tag Manager account and click New Tag. Name your tag Google Analytics 4.

New Tag button in Google Tag Manager

Once you've done that, click Tag Configuration and, select the Google Analytics 4 configuration.

Google Analytics 4 in the Tag Configuration tab

At this point, Tag Manager will prompt you for your Google Analytics Measurement ID.

Measurement ID prompt

You can find your Google Analytics Measurement ID by going to your Google Analytics account and clicking the admin gear icon on the bottom left-hand side of the page.

Then click on Data Streams and select your data stream and you will see your Measurement ID on the top right-hand corner of the page as stated above.

Copy your measurement ID and paste it into Google Tag Manager.

You must now choose a trigger. Select All Pages and hit save.

At this point, Google Analytics should be tracking engagement on your site.