Analytics for Desktop Applications Google Universal Analytics | Blogs | nCircle Tech
Spread the word

What is Analytics?
Like the name suggests, analytics is a field that deals with data management and analysis. It involves studying past historical data to analyze the effect of certain decisions or events that can evaluate the performance of the tools in use. Analytics is very important for businesses as it reads into knowledge that can be used to make improvements or changes in the product.

Why use analytics in the first place?                                         
For every successful business, an optimum utilization resources and time is imperative. And in today’s day and age, there’s nothing more valuable than data. If we don’t read this data properly, many businesses may spend time in enhancing a feature which is least popular in the user community. This means a sheer wastage in terms of valuable resources and time. Thus, tracking a 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 also provide a lot more information associated with the user including
-Number of installations
-Devices and networks used by the user.
-Geographical location.
-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, how consumers are using the application, their behaviour while they use the app and under what circumstances did are they exiting/uninstalling the app. App crashes and faults can also be tracked effectively. Analytics can also help you understand which feature is being used the most and why.

All this information is nothing short of a gold mine, and can help you make better business decisions, that are more effective in terms of both, cost and workforce efficiency.

What kind of applications can integrate Analytics?
All applications should integrate analytics as far as possible, be in on the web, mobile or desktop. 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 options exist in the market already?
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 their own pros and cons. Here is a brief comparison of all three:

table-2

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 Google analytics that was launched last year. It has all types of event tracking capabilities. 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. Universal analytics is better than Google analytics since it enables us to directly send data to the google servers.

Getting Started with Universal Analytics
To begin with, you first need to setup the property (Application setting) in the Google analytics account. The 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 the account creation page. (This is different from your google account). Everything that you select is tracked using a separate account within Google analytics. On the 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 the option for ‘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 the 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.
-Link online and offline behaviour
-Send data from both the web and server.

How to implement measurement protocol in applications?
-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 purposes 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:
Its value should be same as the app id which you get after setting up your property in Universal analytics.
Client ID(CID):
More information about uuid For apps 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. If a visitor is using different browsers or devices to visit a specific website, it will be tracked as multiple unique users. Because of this CID, Universal Analytics allows the tracking of the same user between multiple devices and browsers.

2)SendEventToGoogleAnalytics():It takes 5 parameters which are as follows

Event Category:
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. It can be the title of the video
Event Value:
This parameter specifies the event value if any associated with our event. Its 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.


In future articles, we will try to cover how to analyze the data you have collected.

References:
1)https://developers.google.com/analytics/devguides/collection/protocol/v1/
2)https://support.google.com/analytics/answer/2790010?hl=en
3)https://support.google.com/analytics/answer/1042508

Author: Satej M.

Contact us

Image courtesy: www.pixabay.com

nCircle Tech (inCorporated in 2012) empowers passionate innovators to create impactful 3D visualization software for desktop, mobile and cloud. Our domain expertise in CAD-BIM customization driving automation with the ability to integrate advanced technologies like AI/ML and VR/AR; empowers our clients to reduce time to market and meet business goals. nCircle has a proven track record of technology consulting and advisory services for the AEC and Manufacturing industry across the globe. Our team of dedicated engineers, partner ecosystem and industry veterans are on a mission to redefine how you design and visualize.
Over the last 7+ years, the organisation has worked on more than 150 large and complex projects for 50+ customers across 15+ countries


Spread the word