Sunday, April 21, 2024
No menu items!

Top 5 This Week

bama cap

Related Posts

How To Add A Google Analytics Tracking Code To Your Website

Are you interested in adding a Google Analytics tracking code to your website?

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.

- Ad -

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.

- Ad-

To get your tracking ID, follow these steps:

  1. Log in to your Google Analytics account
  2. On the bottom left-hand side of the page, click Admin
  3. From the left column titled Account, select an account from the dropdown menu
  4. From the middle column titled Property, select a property from the dropdown menu
  5. Under the Property column, click Tracking Info > Tracking Code
  6. Your website’s unique tracking ID is shown at the top of the page under Tracking ID and starts with UA

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.

- Ad -

To copy and paste your gtag.js, follow these steps:

  1. Copy the gtag.js shown on the page (example shown below)
figure 1
  1. Replace the GA_TRACKING_ID with your unique tracking ID provided by Google Analytics
  2. Paste the code snippet right after the <head> tag on each page of your site that you’d like to track in Google Analytics

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:

figure 2
  1. In GTM, select Create Tag and choose Google Analytics
  2. Then select Universal Analytics
  3. Name your tag, preferably something related to Google Analytics (like GA). Add your Google Analytics property ID or gaProperty variable.
  4. Choose the Track Type (i.e. Page View)
  5. Choose your firing triggers such as All Pages, which the tag will fire the tracker on every page of your website.

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 faster
  • Allowing you to send event data to multiple tools as once
  • Keeping all tracking tags in once place in your website code
Vanessa Waithera
Vanessa Waithera
Vanessa Waithera is a young writer from Daystar University. She has been a writer for 7 years and enjoys it as a hobby and passion. During her free time she enjoys nature walks, discoveries ,reading and takes pleasure in new challenges and experiences. Contact: [email protected]

Popular Articles