Categories
SEO

When does the tracking code send an event hit to Google Analytics?

A tracking code is a small script that is embedded in the HTML source code of a website to track the flow and activity of users. Tracking codes are useful for advertisers, webmasters, and marketers to analyse the activity from website visitors. You can use tracking codes to track website access, traffic, click path and other activities. By knowing the activity and behaviour of your visitors, you can review the most reliable marketing campaigns for the best conversion rates. Please note that users need to be informed by a privacy policy if you intend to use a tracking code.

Using Google Analytics to track visitors

Tracking codes are used to retrieve data about website access, traffic, click path and other KPI. However, to be able to read this data you will need metric software like Google Analytics that is linked to your website.

Google Analytics allows you to track micro-conversions. Some examples include the number of page views, sessions, bounce rate, click-through rate metrics among others. It is also capable of tracking events that occur. Events are user interactions occurring on a web page such as downloads, clicking on mobile ads or gadgets or video play count.

Therefore, suppose you want to measure if a conversion sends users to a different URL. For page views, you can set a funnel step goal in the Goals section of Google Analytics. Then, you can set it to update whenever an appropriate URL loads.

Additionally, you can just create an Event by clicking on your Google Analytics account and navigate Behaviour > Events > Top Events. For more information on how to set up event tracking, see here.

Tracking events and metrics help site owners understand better what attracts users and gain new insights on how to increase conversion rates.

Tracking event hits on Google Analytics – when is a hit registered?

As mentioned earlier, events are an advanced Google Analytics feature that gives you the ability to measure a specific user’s behaviour and interaction with a web page element. Web page elements may include videos, gadgets, images, buttons, forms, external links, scroll bars and more.

Each time an event occurs, Google Analytics will trigger a hit. Here are some examples of different events that register a hit:

  • Logins and registrations
  • Mouse movement and clicking of buttons
  • Engagement features such as sharing an article, video, or image.
  • Downloading a file
  • Loading any element via Ajax, JavaScript, or Flash
  • Loading a dynamically generated website
  • Scrolling down a page
  • Video load, play and duration of play
  • Loading of popups and lightboxes
  • Interaction with gadgets
  • Clicking on an image or link

Where do I put the Google Analytics code on my website?

Google Analytics code can be added either in the header or footer of your HTML source code. However, Google recommends you place your code in your header. Why?

It transpires  that if you run a lot of JavaScript on your site, there is a chance that Analytics will not accurately measure your traffic data. Javascript snippets are triggered in the order they were included in your page. Therefore, your page may prevent running footer scripts from previous errors or performance issues from other components.

You can also accurately track traffic statistics because your header scripts are loaded before any other script on your page. Additionally, the tracking code will load asynchronously. This allows other scripts to load simultaneously. Adding the tracking code will not affect your page speed or site performance.

Therefore, for this reason, it is always safer and more efficient to include the tracking code in the header of your site.

Finding tracking code in Google Analytics

You need to create a Google Analytics property for each website you wish to retrieve data from. The property is a unique Tracking ID and a global site that tags and includes the Tracking ID for that property. I will show step-by-step how to find your tracking ID and global site tag.

  • Log in to your Google Analytics account.
  • Click on Admin.
  • Select your chosen account from the menu in the Account column.
  • Next, choose a property from the menu in the Property column.
  • Expand Property, and click Tracking Info, then, Tracking Code.
  • You will find your Tracking ID on the top of this page.
  • Your global site tag can be found further down the page under Website Tracking > Global Site Tag.
  • The Global Site tag is a chunk of code that you will need to paste in each webpage you want to track. Copy the entire contents of the text box and paste it right after the tag on each page of your site.

Benefits of using tracking code with Google Analytics

It is important to understand how your website is performing. How many visitors do you have daily? How long is their duration of their session? Are they your targeted users and are they converting? All these questions can only be answered if you add a tracking code in your web pages. To have a successful marketing campaign, you need to first understand your user’s activities and behaviours and what type of users they are.

Google Analytics gives you the ability to measure each specific user’s activity. Here are some metrics you can measure with Google Analytics:

The source from where users stumbled upon your website
  • Google Analytics Acquisition Overview
      Source: hostgator.com

Google Analytics contains an Acquisition section that provides information on how visitors found your website. Google tracks how many people land on your website from organic results, social media, paid ads or by a search engine.

Learn if your visitors are your targeted users

use Google Analytics to see website visitor demographics

Google Analytics reveals site visitor demographic insights

Your targeted users are the most valuable to you as they increase your chances of conversions. Google Analytics gives information on the type of people that visit your websites such as demographics, location, and their general interests.

Moreover, you can also see their type of device and where they are coming from. This allows you to know how best to optimize your website if most visitors are from mobiles.

Find your most visited pages and conversions

Analyse which pages yield more traffic than others. Google Analytics helps you pinpoint them. You can also detect which pages do well at converting. It can be easily set up by analysing actions that you want your visitors to make such as filling forms, subscription to email lists or marking a purchase.

Overall, if certain elements are being ignored, then you can re-assess the best strategy of their placements on the website. If certain elements are being hit more often, then its a good indication that they are performing well and will most likely give rise to conversions.

Understanding your customers better will help your business grow in the right direction and improve your chances for ROI.

Tracking Code hitting Google Analytics – FAQ

Here are the most asked questions when using Google Analytics to track code:

Where should the Analytics tracking code be placed?

Google recommends you place your code in your header. This way you ensure that your script is run accurately and fast. Running scripts in header means other scripts can run simultaneously. Placing tracking code in the header also ensures it will be run because it does not depend on the previous script that may be erroneous or slow in performance.

What are some common events that are tracked in Google Analytics?

Some common events that are tracked in Google Analytics include the following:

  • Logins and registrations
  • Mouse movement and clicking of buttons
  • Engagement features such as sharing an article, video, or image.
  • Downloading a file
  • Loading any element via Ajax, JavaScript, or Flash
  • Loading a dynamically generated website
  • Scrolling down a page
  • Video load, play and duration of play
  • Loading of popups and lightboxes
  • Interaction with gadgets
  • Clicking on an image or link
How do I find my Google Analytics tracking code?
  • Log in to your Google Analytics account.
  • Click on Admin.
  • Select your chosen account from the menu in the Account column.
  • Next, choose a property from the menu in the Property column.
  • Expand Property, and click Tracking Info, then, Tracking Code.
  • You will find your Tracking ID on the top of this page.
  • Your global site tag can be found further down the page under Website Tracking > Global Site Tag.
  • The Global Site tag is a chunk of code that you will need to paste in each webpage you want to track. Copy the entire contents of the text box and paste it right after the tag on each page of your site.
Can I check the status of my tracking code?

Follow the previous steps above and navigate to the Tracking Code Page. If you are already on the page, then try to reload it. Check the Status message. If it says “Receiving traffic…” then it means the tracking code is working and in progress.

If you have a message saying “N active users right now” with a link to the real-time traffic report, you can click that link. This will give you an indication of what is being tracked by Google Analytics. However, if you have just launched your website or have low traffic, then this may not be visible. Try to perform actions on your website to see if they are reflected in the real-time report.

Are the tracking code and UTM code the same?

You use UTM tags to track external links and you use tracking codes to track events made from internal links. Specifically, you use UTM tags to keep track of acquisitions from your marketing campaigns whereas you can use tracking codes to track elements within your web property.

In Google Analytics, your data from UTM tags will be displayed under Campaigns section under Acquisition while your Events appear under Behaviour.