Google Analytics Training Follow-up


Posted on August 22nd, by Jay Murphy in Analytics, Digital Marketing, Online Strategy. No Comments

We have been presenting how to use and implement Google Analytics quite a bit recently and get some very good questions.  A few questions and answers are:

How to implement Google Analytics on a dynamic website?

This analytics support answer outlines a straightforward approach.  Put your tracking code into a single file and then including the file in your index.php (index.aspx…) and you have tracking throughout the site.  At the risk of being redundant here is how you do it:

  1. Place your Google Analytics tracking code in a file, for this example let’s call this file analyticsTracking.php:
In this file replace
Then in your PHP code (or ASP, JSP,…) include this file with your master page typically and index.php file like this (note the use of the include_once function instead of include to ensure we only include this file a single time):
If you are using a content management solution like WordPress or Joomla there are also some great plugins that install Google Analytics for you – two we like are:

From Yoast the Google Analytics for WordPress plugin.

For Joomla we have used –

WebGuru’s Google Analytics Plugin – Great plugin for implementing Google Analytics on your Joomla website.  (The latest version is available here – http://webguru-co.com/downloads/webguru-google-analytics-v.0.9.zip)  We make a slight modification by adding the Google Analytics code just before the </head> tag:

What is the time on page for the last page of a visit?

Avinash Kaushik, analytics expert and blogger extraordinaire, discussed this in his Time on Page and Time on Site post.  Sadly the time on this page is 0, yes a big goose egg, not because users did not really spend time on this page, but because there is no reliable way to measure the last page of a visit.  (In a nutshell time on page is determined by measuring the time you navigate to a new page on the site and subtracting from the time you reached your starting page.  Read the post for a complete explanation.)

The last page a visitor views is typically a page with a goal, so think carefully of other ways to measure this visitor interaction – event tracking, setting this page as a goal.

During one recent talk someone asked if there could be some javascript running in the background that would trigger the page when the user left the page.  (In Avinash’s blog a commenter named Serge presents a similar idea using the page unload event.)  This is a great idea.  As Avinash states in his blog Google Analytics (or any other analytics tool for that matter) would have to use this new information for calculating the last page time.  (To avoid having two methods for calculating time on the last page.)  Another idea is to run an event based off of a time on the page – this is on my list of Analytics experiments.

What’s a good way to gain analytics experience?

A way to gain some more analytics experience is the Analysis Exchange – mentors and students work together on setting up a non-profits online analytics.  More information visit What is the Analysis Exchange?

Be Sociable, Share!




Leave a Reply

Your email address will not be published.

wordpress Wordpress Theme