Google Analytics

Posted: March 16, 2011 in Google

A tool we all should know by know is Google Analytics which for those who may not know (where have you been ?) is used to track your website activity, how many visits, views, bounce rate, product performance, popular pages, visits sources etc. This is one of The search giant – Google’s outstanding products.

There are a lot of companies who take full advantage of such products because of the advance features it offers.

Google Analytics involves a process whereby snippets of code are used to track all activity taking place on specific tracked pages within a website. These snippets of code are called Google Analytics Tracking Code (GATC).

The process of tracking begins when a visitor submits a transaction which is then received by the web server which usually passes that data to the application server where it is processed. This process may include adding the data to database or validating a credit card at a point where you create a receipt page for the visitor. This is where you make modifications to accommodate Google Analytics but before the application sends a receipt back to web server it must make some info about visitors transaction and this information is tranmitted to Google Analytics Server via a request for an invisible GIF file named _utm.gif.

Three steps are involved in adding Google Analytics e-commerce tracking to a site
  • Making sure the tracking code is installed – receipt page must be tagged
  • Enable e-commerce reports to profile which is disabled by default
  • Making application logic to show the e-commerce tag with transaction data

Some problems to look out for :

Duplicate content – usually a result of copy-pasting the same text in different pages or submitting the same content/article/review in multiple sites. Additionally poor Web development techniques or of developing a bad link structure.

Garbled data

Inflated e-commerce revenue

Tracking third party e-commerce platforms

Mobile Tracking

Mobile tracking helps track all the mobile visitors to your site who access it using various mobile operating system (iOS, Android, Rim etc). You do however find that not every is using the advanced mobile OS’s as mention, those are the people still using very old cellular devices and therefor tracking these visitors need to happen on the system level where as the modern way takes place on the server level. Google provides four mobile tracking libraries namely PHP, Java, ASP, and Perl, they all work in the same way although the code may be different.

To track mobile built in PHP you must add a block of PHP code before the<HTML> tag on all your mobile pages. You must also add a small block of PHP codeimmediately before the closing </BODY> tag.

In addition to tracking mobile and standard websites Google Analytics can also track mobile apps. This however is different from tracking website because app functionality is different from websites. Although App tracking is currently available for iPhone and Android applications. Those interested in tracking apps can download the SDK from Google.


One of the essential parts of GATC is _trackPageview(). This is A method where visitors data is collected, stored in cookies and sent to Google Analytics Server. Here is a snippet of code using  __trackPageview (bold).

<script type=”text/javascript”>var _gaq = _gaq || [];_gaq.push([‘_setAccount’, ‘UA-XXXXXX-YY’]);_gaq.push([‘_trackPageview‘]);(function() {var ga = document.createElement(‘script’); ga.type = ‘text/javascript’;ga.async = true; ga.src = (‘https:’ == document.location.protocol ?’https://ssl&#8217; : ‘http://www&#8217;) + ‘’;var s = document.getElementsByTagName(‘script’)[0];s.parentNode.insertBefore(ga, s);})();</script>

This may not mean much to many but the things it can do are awsome. Everytime a _trackPageview() executes a pageview is created by sending data to GA server and each pageview includes many dimension like IP address, city, country, region etc.


The very same process is used to track visitors clicks, outbound links and non html files like pdf’s. below is a snippet of code with this example

<a href=”/schedule.pdf” onclick=”_gaq.push([‘_trackPageview‘,’/vpv/downloads/pdf/schedule.pdf‘]);” />PDF</a>

To conclude Google offers a very useful and powerful product that enables us to track our products performance among other things. This in return tells us a lot about our customers what they are looking for what they like, what they don’t, what the view , what they buy and this becomes a behavior that the supplier of the product can use to their advantage. There is more to this tool then what meets the eye and I am yet to discuss more on it in the next coming weeks so keep yourself posted.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s