There are a few ways to add Google Analytics tracking code to your website. Adding Google Analytics to your website enables you to track the number of visitors to your site, the search keywords they use to find your site, the time spent on your site, goal conversion and much more. We’ll explore two ways to add Google Analytics code to your website. The first step you’ll need to do is find your tracking ID, which is a unique ID created for your Google Analytics account. To get your tracking ID, follow these steps: Once you’ve identified your tracking ID, you’ll need to get your tracking code snippet, which can be found on this page as the Global Site Tag (gtag.js). The gtag.js is the tracking code for this specific property and you’ll need to copy and paste this code to every webpage you want to track on your website. To copy and paste your gtag.js, follow these steps: Keep in mind that gtag.js (launched in 2017) is a newer, more expanded version of analytics.js.

Google Tag Manager

You can also use Google Tag Manager to add the Google Analytics code to your website. Google Tag Manager is a free tool and is useful for websites that use multiple analytics or advertising performance tools from multiple campaigns. To install Google Analytics code via Google Tag Manager (GTM), follow these steps:

Gtag.js or Google Tag Manager?

If your website is already using Google Tag Manager, then gtag.js is not necessary and continue to use GTM. Since GTM inherently combines event data from Google Analytics and Google Adwords, it’s best to keep it running if it’s already in place. However, if you haven’t installed GTM and are not planning on investing in Google Adwords, using the gtag.js may be beneficial to your website. The gtag.js tag makes the tracking process easier by:

Streamlining the installation process to get Google Analytics code on your site fasterAllowing you to send event data to multiple tools as once

Keeping all tracking tags in once place in your website code

Either way, we recommend that you add Google Analytics to your website, so you can keep track of all your event data.

How To Add A Google Analytics Tracking Code To Your Website - 2