close button

Web analytics: how to add web tracking to your website

Published by

It would be a mistake to think that once you have built your website, all your work is done! Once it is online for all to see, you must spend some time to market your website in order to get traffic. You also want targeted traffic, so that you get visitors to your site who are actually interesting in what you produce, and who are likely to buy or subscribe to your newsletter. But how do you track your progress? This is where website analytics comes in!

The importance of web analytics and its role in marketing

One of the most important parts of internet marketing is one that is often overlooked: tracking your visitors. Tracking involves more than just tracking the number of visits. Website analytics tools such as Google Analytics demonstrate the wide variety of ways that web analytics data can be combined, presented and graphed.

web analytics comparison

About Google Analytics

Google Analytics is a web analytics, or website traffic tracking tool that developed by Google. There is a fully functional and useful free version. All you need is a Gmail/Google account to sign up for Google Analytics. You can do this by going to http://www.google.com/analytics/ and signing up. Google Analytics has a plethora of tools and analytical tracking mechanisms that allow you to track a number of types of data, decide which data you want to focus on in your campaigns, and focus in on a specific demographic that is most likely to purchase from you.

What can you do with web anaytics?

Web analytics allows you to track things like:

  • Time on page (Sessions)
  • Exit and entrance pages
  • Visitor behaviors
  • Most popular pages
  • Countries of origin
  • Device type
  • Browser type

These are all very useful metrics, which enable you to know and measure exactly where your traffic is coming from, so that you can manage and adjust your website content appropriately for your audience. This is just a small list of the user behaviors and information that you are able to track in Google Analytics. You can also perform experiments such as Split A/B testing on your website to see which site is most successful with customers.

The default view when you first access analytics for a website is a graph of the number of daily sessions for the previous month. The date range can be changed, and you can overlay data from different time periods for comparison. Instead of plotting sessions, you can also plot pages per session, number of pageviews, time per session, and many more metrics.

You can also break down your traffic by geography, demographics, user interests, device and operating system type. On top of all this, you can also learn which pages of your website are the most popular, and you can find out what inbound links are driving traffic to any particular page, or whether search is the main traffic driver.

There is a lot of data to be explored here, but if you take the time to learn about web analytics, you can gain valuable insights into what is driving traffic to your website. The image below shows many of the options available in the Google Analytics side navigation (laid out horizontally for illustration purposes here)

Google Analytics: options

How to add Google Analytics to your website

How does Google Analytics track all this data on your website and report it in its database? With tracking code! The web tracking occurs by placing a custom code within any page on your site that you wish to track; then you will be able to see the exact behaviors of visitors, their demographics, and engagement level on the Google Analytics reports pages.

To add Google Analytics to your website, you need to do the following:

  1. Visit the Google Analytics webpage http://analytics.google.com
  2. Add your website domain to be Google Analytics
  3. Obtain the custom tracking code for your site
  4. Copy and paste the tracking code into each page on your website that you want to track

The custom tracking code will look something like this:

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-1234567-1', 'auto');
ga('send', 'pageview');

</script>

The generated code can be copied anywhere in your webpages. Google recommends to place it before the closing </head> tag of your webpages, but it will happily go anywhere in your webpage.

If you are using a CMS such as WordPress or Drupal, then you should add the analytics code to the main page template of your site, so that it is included in every page.

(Note that there is another approach to adding the tracking code to your website, using the Google Tag Manager. We do not cover this approach here!)

Goals and conversions

Your goals for your website may be different at different times during its lifetime. Google Analytics allows you to track your specific goals easily. Simply start a new Goal within the platform and you can start to track it. Goals measure completed actions or conversions. Examples of conversions include making a purchase or submitting a contact form. After setting up a goal, Google Analytics will report how your goals are progressing, if you are reaching the levels of conversions or other behaviors you desire, and more. You determine what your goals are, and you can add and delete them as necessary.

How to do A/B split testing

Google Analytics has an experiment feature which allows you to do a number of different types of experiments on your site. One of these is Split A/B Testing. This method using a scientific methods approach to testing which version of your website works best with visitors. This is done by putting up two slightly different versions of your website, with only a few key elements changed on the second version. Then you watch for site responsiveness, level of visitor engagement, and click through ratios to determine how much the visitor connected with and used your site. By comparing the two versions of your page, you can determine which one is most likely to produce a higher level of engagement and conversions. Google recommends that when you perform such experiments, you limit the changes from the two versions to only one element at a time, such as a call to action button, the colors of your design, or other small change. Making too many changes in the second page convolutes the experiment and may confuse the results. The goal is to determine what elements caused the higher engagement and action from visitors so you are literally trying to isolate this variable.

KISSmetrics

Another handy tool for web tracking and website analytics is KISSMetrics. Though not quite as popular as Google Analytics, KISSMetrics is a great new tool that gives you specific information on visitor behaviors and engagement, and also is capable of tying your account in with your Google Analytics account so that it can analyze that data as well. The goal of their platform is to give you a completely integrated look into your website statistics, using both their tools and Google Analytics to give you a more detailed analysis of user behaviors and statistics. The main difference between KISSmetrics and Google Analytics is that KISSmetrics primarily tracks people across sessions, while Google Analytics primarily tracks sessions (although user-tracking has been added).

Summary

Web tracking is essential tool to know how well a website is performing, and to ensure website success in the long run. It allows you to know exactly what your website is doing in terms of conversions, visitor engagement, and other important metrics. By inserting a simple HTML/JavaScript-generated code from your analytics provider, you will be able to track the progress of your site and drill down into specific aspects that are most likely to bring in the customers who are most likely to purchase. Using complementary tools such as using KISSmetrics and Google Analytics is also beneficial as they supplement each other with added insights into what is going on with your website. By tracking how visitors arrive at your website, and by understanding what they are doing on your website, you can tailor your website to their needs and ultimately grow your business or following.

Main image: Lauren Manning