Google Analytics is a ginormous platform that lets you track the user actions and behavior in the digital era of merchandising and provides insights based on those user actions, in various ways. There are many root node of Google Analytics which hold hands together in providing insights, such as customizable reports, real time visitors views, automated data collection, easy integrity with other platforms, etc. But to make these specified features significant, in the core of Google Analytics tracking lies the Client ID. After we go through the benefits of Client ID, we will grease the wheels on how to track Client ID from iOS device.
What is Client ID ?
Client ID can be described as a unique identifier for any user, limiting the user’s sphere to a specific devices or a browser. It can be considered as a pivot point for the data relative to a unique user. It also contributes majority in the Audience report in Google Analytics to provide measurement of user count with a cardinality of New Users and Returning Users. To sum up, Google Analytics is totally dependent on Client ID to measure the audience of your application, and using Client ID Google Analytics also provides brief detail on the Active Users for a specific time span.
Let us now capture the essence of Client ID and understand how it can be used in visualizing data in an eloquent way. We will walk through two different use-cases that utilize Client ID in visualizing the data.
- Mapping of events at user level :
Assume we are a lead generation marketer and we have successfully implemented event tracking for various actions of the users. The manager now demands the count of those users who have performed some combinatorial action on a day or some specific day.
In this case, Client ID will be a root node and behave as a unique identifier for each user. It will return the events performed by a particular user, fulfilling the combination requirement.
- Targeting a set of audience :
Implementation of Client ID will give a facility to make a segment based on their activity and can be targeted as an audience to lead conversion. For every business, it is very important to know about the users, their activity and conversion. For example – There are 100 users who have visited your website. They take a set of actions and then exit. Client ID as a dimension will help businesses to find the user journey and these users can be targeted to see through a transaction or lead generation.
A list of ClientID can also be exported to Adwords and various remarketing activity such as personalized recommendation or showing products depending upon their past behaviour.
Looking on the other side of the coin, with the advantages of Client ID, we must also be aware of the limitations that it has. Client ID is a standard dimension of Google Analytics and unfortunately, we cannot use the Client ID in Custom Reports that we use to visualize data according to our requirements. But guess what, we can track the Client ID in a custom dimension and use it in Custom Reports to analyze the data.
Client ID Tracking Implementation
Moving further, lets take a look on how to track Client ID from iOS device’s either in a custom dimension or in an event through Google Tag Manager using the dataLayer method. Follow the below steps :
- To send Client ID in GA using dataLayer your app should have GA SDK as well as GTM SDK installed. Follow below mentioned links to install and initialize GA SDK and GTM SDK in your iOS project.
- Once SDKs are initialized, one instance will be created of GA Tracker which will be used to get the Client ID. After getting a Client ID a dataLayer instance will be created to push Client ID into a dataLayer.
Below mentioned code snippet will get Client ID and push it into a dataLayer. This mechanism should be implemented inside the first screen of your application. Write below code in the viewDidLoad method of your ViewController.
OR Add the variable clientId in the openScreen DataLayer as mentioned in this blog
DataLayer push code snippet holding Client ID
- Since we are using Google Tag Manager it is necessary to configure a Tag in GTM which holds the setting to track the Client ID in Custom Dimension.
Tag configuration with setting Client ID in Custom Dimension.
The custom dimension for Client ID should be User level scope in Google Analytics. This will help you analyze and understand actions of the user.
With this step, we are now through with implementation of Client ID tracking. Once Client ID starts getting tracked in Custom Dimension, you can generate custom reports and visualize the data as per your requirements.
For any assistance in Google Tag Manager setup or Tag Configuration you can visit our blog How to Implement Google Tag Manager in iOS Swift – Part 1 of 2 or feel free to leave a comment in the section below.
Nice Informative Blog
Thank you for your site.
I have the clearly knowledge about Client ID.
Thank you for your feedback. We are glad you found this blog resourceful