Analytics for Desktop Applications: Google Universal Analytics
Analytics for Desktop Applications: Google Universal Analytics
What is Analytics?
Analytics is a field of data analysis.It involves studying past historical data to analyze the effect of certain decision or events or to evaluate the performance of a given tool.The main purpose of the analytics is to improve the business by gaining knowledge which can be used to make improvements or changes in the product.
Why should we integrate Analytics in application?
For every successful business it is important to make optimum utilization of your resources and time. Often, many of us spend time in enhancing a feature which is infact least popular in the user community. So in business terms it is waste of your valuable resource and time. Tracking customer’s activity by implementing analytics gives you that edge and information to determine the most popular features of your application. Along with user activity, analytics can provide you a lot more information associated with the user. For e.g.
-Number of installations
-Devices and networks used by the user.
-Workflow of the user.
-Conversion ratio of the users.
-Time spent by the user.
Once you have this data from your user base, it can help you to understand, under what circumstances did users decide to exit from your application. Were there any crashes while running the application. Did users repeatedly make mistake using the application and so on. For e.g. if your application has a file import feature and you want to understand which file type is most often imported by the user, analytics can help you to get that insight.
All this information will help you to make better business decisions and in turn make it a very successful business.
What kind of applications integrate Analytics?
Any and all applications should integrate analytics as far as possible. Web applications, mobile applications as well as the desktop applications. You may have to update your End user terms and conditions when you add analytics to your application as this may infringe the privacy of the user to some extent. The legalities of the analytics is beyond the scope of this article. Please contact a legal consultant to help you update terms and conditions.
What are the options?
There are are lot of analytics tools available in the market but in my personal experience Mixpanel, Deskmetrics and Google Analytics are the most efficient ones for desktop applications. Each one has Pros Cons. Here is a brief comparison of all three:
It is up to the reader to decide which analytics is most suitable for their application. In this article we will focus on Google universal analytics and how to use it to track events.
About Universal Analytics
Universal Analytics is the new version of the google analytics.It was launched last year from google.It contains all types of event tracking capability.It has the ability to track a user’s behaviour among different devices.One new important feature added by google in this analytics is measurement protocol through which we can import data from online and offline devices. An advantage of Universal analytics over the google analytics is that we can directly send data to the google servers.
Get Started With Universal Analytics
To begin with ,you first need to setup the property (Application setting) in google analytics account. Properties are where you send data and set up reporting views. If you are new to google analytics, as soon as you sign up, it will take you to account creation page.(This is different from your google account). Everything that you track, is tracked using a separate account within google analytics. On account creation page, you will be able to setup property settings. If you are unable to get to new account creation page, go to google analytics dashboard, click admin, and create a new account from accounts dropdown box.
While setting up the property make sure you choose mobile app. Note down your appname and the tracking id(UA-xxxx-x) for your app which you will get once you finished with setting up the property.
We will be using this tracking id to send tracking information, corresponding to your application, to google analytics server. In order to send this tracking information, we use Measurement Protocol.
About Measurement Protocol:
The Google Analytics Measurement Protocol allows developers to make HTTP requests to send raw user interaction data directly to Google Analytics servers. This allows developers to measure how users interact with their business from almost any environment. Developers can then use the Measurement Protocol to:
-Measure user activity in new environments.
-Tie online to offline behaviour.
-Send data from both the web and server.
How to implement measurement protocol in application?
-In order to send the data to google analytics server you have to make an http post request to www.google-analytics.com/collect .
-For application tracking you have to add certain parameters in the request.(for e.g. Application name,tracking ID,Client ID and application version)
-Analytics server use this information to recognise in which profile it should update the events.
-For event tracking purpose you have to add parameters like event category,event action,event label and event value. More details are available here.
In order to facilitate the integration of analytics into desktop applications we have created a C++ library.
The details of the library are as follows:
This library mainly uses measurement protocol(V1.0) to send the event data to the universal analytics server.Inside the library we are creating the appropriate Http post request and sending data to analytics server using WinHttpClient.
This library mainly contains two functions:
1)SetApplicationSetting() : It mainly takes 4 parameters which are as follows :
Application Name :
It should be same as the application name which you select while setting up your property in order to track your application.
Tracking ID :
It’s value should be same as the app id which you get after setting up your property in Universal analytics.
Client ID(CID) :
For more information about uuid For apps, this is randomly generated for each particular instance of an application install. The value of this field should be a random UUID (version 4) as described in http://www.ietf.org/rfc/rfc4122.txt.In Google analytics,if a visitor is using different browsers or devices to visit a specific website,it will be tracked as multiple unique user.because of this CID,Universal Analytics allows the tracking of the same user between multiple devices and browsers.
The version of your application.
2)SendEventToGoogleAnalytics() :It takes 5 parameters which are as follows
This parameter specifies the event category.It should not be empty.(For example if there is video section in the webpage then parameter for this will be “Videos”)
Event Action :
This parameter specifies the event action.It should not be empty.(For example if user play’s any video from video section then the parameter for this will be “Play” )
Event Label :
This parameter specifies the event label.(For example it can be the title of the video).
Event Value :
This parameter specifies the event value if any associated with our event.It’s value should be non-negative.
Screen Name :
This parameter is used to track the user activity on the particular page or the tab.It is mainly useful to get the pageview count.
While integrating this library in your application call the SetApplicationSetting() function only once at the beginning of any event tracking,and then start tracking the events using SendEventToGoogleAnalytics() function.
The real time overview window of google analytics will look like this,
The google analytics console window for all tracked events look like this,
In future articles I will try to cover how to analyze the data you have collected.
Author: Satej M.