Saurabh Kumar talks about Online Marketing, SEO
Marketing Trends to Watch in 2024
Feb 05, 2024
2023 left you breathless, didn't it? From privacy regulations tightening their grip to the AI revolution accelerating...
Mar 14, 2018
by Saurabh Kumar
I realise we have all always wanted to know how visitors actually interact on our website through different devices. For example, what are the combination of devices through which they come and get converted here as leads for us. Additionally, the lifetime value of different user types and differences between members & non-members are not available in any basic GA reports.
This happens because in a regular view of Google Analytics, the counts of users and sessions are separate if the same user enters our website using an iPad, a desktop, or/and an Android mobile phone.
To handle this problem and to give more accurate user and session counts, Google Analytics came up with the feature "User Id" through which we are able to unify the sessions that a single user is making using different devices, into one user in Google Analytics.
In GTM, retrieving a variable can be done by various ways, and here, we’ll retrieve a logged-in user’s userId that was stored in a cookie which was set by your site’s login system.
Following are the steps to do this:
Create a new Variable in GTM, name the variable “User ID”.
Select “Custom Javascript” as the variable type.
Write a JavaScript function that retrieves the userId variable from your site’s login cookie. The retrieval of your userId variable depends on your site’s particular setup so you’ll need to write your own function here to retrieve this data. Important: the end result of your function should return just the identifier that you want to pass to Google Analytics as the userId.
Note: Google’s terms of service prohibit using personally identifiable information as a userId, don’t use names and email addresses.
Create a new Tag, name it “userID Tag“.
Select the GA Tracking ID for the profile you enabled User-ID tracking for in step 1.
Under more settings, set the Field Name to “userId“. Set the value to “{{user id}}“.
Set the triggering to All Pages.
Note:The data in this User-id tracking view updates every 10-15 minutes.
So, you have learned to set up User-id tracking via GTM, and hence you should know the four main benefits of that:
Begin With a Free Quote
Saurabh Kumar talks about Online Marketing, SEO
Feb 05, 2024
2023 left you breathless, didn't it? From privacy regulations tightening their grip to the AI revolution accelerating...
Saurabh Kumar talks about Online Marketing
Jan 15, 2024
Imagine strolling through a store where clothes practically jump off the rack, whispering "perfect fit!" Imagine robots not as cold, metallic monol...