Google analytics

As I now have my own domain name registered and configured to readdress my GitHub domain name I thought it would be appropriate to start learning Google’s analytics service. It’s a free service that tracks and reports traffic to your website or mobile application providing very detailed summaries in various formats. Initially there will be a bit of a learning curve to understand the many back end features provided but with time you will come to appreciate the detailed visualisation of the captured data and how exactly you can use that to your advantage.


Understanding the data analysis of your potential consumer base can very effectively provide you with new opportunities to improve the quality of service you provide, potentially turning simple visitors into customers. Allow me to walk you through the process of creating a google analytical account, explain some of its features and how to incorporate this into your own products.

Creating an account

First we need to start by creating an account over here. You will need a domain name before you can sign up. Fill out the appropriate detail, select an option for mobile app or website etc. its fairly standard user form. At the bottom however you will be given a few options as to what data you wish to share with google. Now here is the important part, google will allow you to create up to 100 main accounts, each of these main accounts can have 50 unique properties. With each property you have you will receive a unique tracking id that will allow google to identify what web pages to track and collect data from.

Admin panel

Once you have properties and accounts set up you can select various options to view the data collected over time. In the image below you can see some of the options listed below and how simple it is to switch between accounts to get the key information you need such as unique id’s, past data collected and access other useful features.

Admin panel properties

Unique user ID

Now that you have a valid user account google will allow you to track up to 50 unique applications of your own under the one account name. Not to get confused with your account name or account ID each application will have its own unique tracking ID which you need to be careful not to mix up or else you will receive false readings. Receiving traffic data for the wrong app or having a single tracking ID receive the traffic for two apps will provide very harmful readings and mislead the results of any data analysis operation.

To find your unique id for any web application, head to the admin panel and select the account that the property is registered under and select tracking info -> tracking code.

Js snippet

Google will provide a very simple Js snippet that you will have to incorporate into your source build. It is recommended to have this in the header tag as the last script to be called. Depending on the technology stack you are working with it is quite easy to have this be generated as an include file and call it to save you repeating the same block of code for every page.

	  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

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


Include in php example

	<?php include_once("analyticstracking.php") ?>

Jekyll example

For Jekyll I have that script in the “_include” folder and called that script within the header element so within every page and post the script is called. This purpose of the if statement is to check that the website is running in live or in a test environment. consider it a safety check to stop you from receiving false feedback.

Jekyll code


To quickly test that you have successfully integrated google analytics into your project click on the “send test traffic” button on the admin panel and that will simulate a live connection. If successful this should return a positive result in your live active user. To view previous visitors click on the audience tab and click overview for some data visualisation on traffic data.


With its fairly simple to set up process, google analytics becomes one of the most essential tool available to organizations of all sizes looking to expand. For a free service to provide so much even to single users you can see why google analytics controls the majority market share in analytics. Undeniably the value of the key and accurate data gathered that is then displayed using simple graph visualisation cannot be understated, its method of displaying-what would be a complicated process-into simple tab sections for analysis that any non-technical user can understand. It didn’t take long for me to understand the core functionalities provided as the UI design is quite simple, everything is placed under a sensible header. I highly recommend you make an account and play around with this. You may receive some interesting results as to where visitors are accessing your application.