User ID tracking with Google Analytics 4 and Google Tag Manager
Summary
TLDRIn this tutorial, Julius from Analytics Mania demonstrates how to set up user ID tracking on a website using Google Analytics 4 (GA4). He explains the importance of this feature for recognizing users across multiple devices and guides viewers through the process, from integrating it into Google Tag Manager to verifying its implementation. Julius also covers how to create a user-scoped custom dimension for using the user ID in various GA4 reports, ensuring a comprehensive understanding of tracking user behavior on websites.
Takeaways
- 😀 Implementing user ID tracking in Google Analytics 4 (GA4) is beneficial for correlating user activity across multiple devices to a single user profile.
- 🔒 User ID tracking requires a login functionality on the website, enabling the association of a unique user ID from the database with GA4.
- 🛠️ The user ID must be pushed to the data layer, which can vary depending on the content management system or platform being used.
- 👩💻 Developers play a crucial role in custom websites, needing to insert the user ID into the data layer for GA4 to recognize.
- 🔄 For platforms like WordPress, plugins such as 'Google Tag Manager for WordPress' can automate the process of adding user IDs to the data layer.
- 🔍 The Google Tag Manager (GTM) preview mode is used to verify that the user ID is correctly pushed to the data layer after login.
- 📊 In GTM, the user ID from the data layer is turned into a variable to be used in GA4 configuration tags.
- 📝 The 'user_id' parameter in GA4 configuration tags should be populated with the user ID variable created in GTM.
- 🕵️♂️ Debugging in GA4 allows for the verification of the user ID being received and associated with user activities.
- 📈 User ID information can be found in standard reports and the explore section of GA4, helping to differentiate logged-in users from regular visitors.
- 🔄 To use the user ID as a dimension in other GA4 reports, a user-scoped custom dimension must be created and the user ID sent as a separate parameter.
Q & A
What is the purpose of user ID tracking in Google Analytics 4 (GA4)?
-User ID tracking in GA4 helps to identify a user across multiple devices as the same individual, ensuring that a person using a smartphone and a laptop is not reported as two separate users.
Who is the presenter of the video and what is the channel's focus?
-The presenter is Julius, and the channel, Analytics Mania, focuses on teaching people how to work with Google Tag Manager and Google Analytics.
What is a prerequisite for implementing user ID tracking on a website?
-The website must have a login functionality, allowing users to sign up and log into their accounts, as this is necessary to assign a unique user ID from the database to each user.
What is the role of Google Tag Manager in user ID tracking?
-Google Tag Manager is used to configure tags that send user IDs from the website's data layer to Google Analytics, enabling the tracking of user activity across different devices as a single user.
How can one check if the user ID is being sent to the data layer?
-One can check this by using the preview mode in Google Tag Manager, where the user ID should appear as part of the event data after a user logs in.
What is the importance of the user ID being unique and not containing identifiable information?
-The user ID must be unique to avoid混淆ing users and must not contain identifiable information like email addresses or social security numbers to comply with Google's terms of service.
How can a developer assist in the implementation of user ID tracking?
-A developer can assist by implementing code on the website to push the user ID to the data layer, ensuring that each user's ID is unique and corresponds to their account in the database.
What is the process for creating a variable in Google Tag Manager to capture the user ID?
-In Google Tag Manager, one must go to the Variables section, create a new User-Defined Variable, configure it to capture the data layer variable that contains the user ID, and name it accordingly.
How can one verify if the user ID tracking is working properly in GA4?
-One can verify by logging into the account on the website, checking the Google Tag Manager preview mode to see if the user ID is being sent, and then checking the GA4 debug view to confirm the user ID is received.
What additional step is required to use the user ID as a dimension in other GA4 reports?
-To use the user ID as a dimension in other reports, one must create a user-scoped custom dimension in GA4 by sending the user ID as a separate custom dimension and configuring it in both Google Tag Manager and GA4.
How long does it take for the new user-scoped custom dimension to appear in GA4 reports?
-It takes approximately 24 hours for the new user-scoped custom dimension to be processed and appear in GA4 reports.
What should one do after confirming that the user ID tracking is working properly?
-After confirming that the user ID tracking is working properly, one should publish the changes in Google Tag Manager and wait for the data to appear in GA4 reports.
Outlines
📚 Introduction to User ID Tracking with Google Analytics 4
In this video, Julius introduces the topic of configuring user ID tracking on a website using Google Analytics 4 (GA4). He explains the importance of user ID tracking for accurately identifying users across multiple devices and highlights that this tutorial assumes some basic knowledge of Google Tag Manager (GTM) and GA4. He also mentions a link to a beginner's tutorial for those new to GTM.
🔐 Understanding User ID Tracking
Julius explains that user ID tracking requires a website with login functionality, as each user has a unique ID in the database. This ID helps GA4 recognize users across different devices. He demonstrates logging into a demo website and stresses the need to push the user ID to the data layer, which is crucial for configuring GTM to send the user ID to GA4.
👨💻 Implementing User ID in the Data Layer
To get the user ID into the data layer, Julius discusses working with developers to implement the necessary code. He provides sample code for pushing the user ID and shows how to check its proper implementation using GTM's preview mode. He emphasizes that sensitive information like email addresses or social security numbers should not be included in the user ID field.
🔧 Creating a Data Layer Variable in GTM
Julius demonstrates creating a data layer variable in GTM to capture the user ID. He guides through the steps of configuring the variable and integrating it into GA4 tags. He highlights the importance of naming conventions and case sensitivity when creating variables.
📝 Adding User ID to GA4 Configuration Tag
Julius shows how to add the user ID to the GA4 configuration tag in GTM. He explains the steps to insert the data layer variable for user ID and discusses how multiple GA4 tags can inherit this parameter automatically. He then tests the implementation to ensure it works correctly by checking the tag assistant and GA4 debug view.
📊 Viewing User ID Data in GA4
Julius explains how to view user ID data in GA4 reports. He demonstrates creating comparisons in standard reports and exploring user data in the User Explorer section. He notes that logged-in users will have shorter IDs from the database, while others will have randomly generated client IDs.
🔍 Creating User-Scoped Custom Dimensions
Julius addresses the limitation of user ID not being available as a standalone dimension in GA4. He explains how to create a user-scoped custom dimension by sending the user ID as a separate custom dimension. He walks through configuring this in GTM and GA4, testing the implementation, and ensuring the custom dimension works correctly.
🚀 Final Steps and Publishing Changes
Julius summarizes the final steps of testing and publishing the GTM container. He encourages viewers to regularly check for updates and mentions the importance of sending the user ID with every event from the website to GA4. He concludes by inviting viewers to like the video, subscribe to the channel, and stay updated with more tutorials.
Mindmap
Keywords
💡Google Analytics 4 (GA4)
💡User ID Tracking
💡Google Tag Manager
💡Data Layer
💡Unique User ID
💡Login Functionality
💡Custom Dimension
💡Event Tracking
💡Preview Mode
💡Publish
💡Debug View
Highlights
Introduction to configuring user ID tracking on a website with Google Analytics 4.
Importance of user ID tracking to avoid reporting the same person as different users across devices.
Explanation of sending user IDs from the website database to Google Analytics for better user tracking.
Basic requirement of having a Google Analytics 4 configuration tag with a measurement ID.
Steps to implement user ID tracking if the website has a login functionality.
Instruction to get the user ID into the data layer for Google Tag Manager to access it.
Example code snippet provided for developers to push user ID to the data layer.
Using Google Tag Manager preview mode to verify the user ID is correctly pushed to the data layer.
Creating a data layer variable in Google Tag Manager to use the user ID.
Adding user ID as a field in Google Analytics 4 configuration tag within Google Tag Manager.
Testing the implementation by logging in and verifying user ID is received by Google Analytics 4.
Exploring where to find user ID information in Google Analytics 4 reports and debug view.
Steps to create a user-scoped custom dimension in Google Analytics 4 for using user ID in reports.
Publishing the changes in Google Tag Manager after testing the implementation.
Encouragement to subscribe to the channel for more tutorials on Google Tag Manager and Google Analytics 4.
Transcripts
in this video you will learn how to
properly configure user id tracking on a
website with google analytics 4.
[Music]
hey my name is julius and welcome to
another's mania youtube channel if you
are new here i teach people how to work
with google tech manager and google
analytics so if you want to stay up to
date with ga4 consider subscribing if
you have a website where people can log
in then it makes sense to implement user
id tracking because if you don't then
the same person with multiple devices
can be reported as different users user
id tracking can help you with that
because when a user logs in into his or
her account on your website you will
send a user id from your database to
google analytics then ga will understand
that this person with a smartphone is
the same as this one with laptop so
let's take a look at the implementation
in this video i presume that you already
have some basic knowledge about google
tag manager and google analytics so this
means that you have at least created a
google analytics four configuration tag
where you have your measurement id added
right here if you are completely new to
this then take a look at the google tag
manager tutorial for beginners and i
will post a link to it below the video
also in this google tag magic container
i have one google analytics for event
tag that sends the purchase when a
visitor makes a payment when it comes to
user id tracking it means that your
website must have some sort of login
functionality or in other words your
visitors can sign up and log into their
accounts this is needed because in your
database every user has its own unique
id and in this video we're going to send
that id to google analytics this is
important because google analytics 4 can
use that user id to understand that a
visitor who has logged in maybe from a
different device is still the same
person on this demo website i have a
login page where i can enter my username
and password and then log in so let's do
that let's enter my username
and click login this is obviously a fake
page and in reality i would be able to
do something but just for demonstration
purposes this is the only thing that you
can see basically a blank page but what
is important now is that i have logged
in and this is my account to implement
the user id feature you must somehow get
the user id into the data layer because
then we will configure google tag
manager to take that user id from the
data layer and send it further to google
analytics there are various ways how you
can get user id in the data layer but
those ways depend on what kind of
content management system or what kind
of platform are you using if you're
dealing with a custom built website then
your best shot would be to cooperate
with developers and ask them to push the
user id to the data layer here is a
sample code that your developer could
implement on a website once this code is
activated you will see in the preview
mode of google tag manager the event
name which is user data and then user id
which is this one your developer would
be responsible for replacing this with
the actual id of the user who has just
logged in simply copy pasting this code
will not be enough because this part
must be different for every user so the
id of one user can be something like
this while the other user's id might be
something like this if you're dealing
with a popular platform for example
wordpress then you could try to find a
plugin that you can install on your
platform and that plugin will push the
user id information to the data layer
speaking of wordpress there is a very
popular plugin called google tag manager
for wordpress and when a user logs in on
your website that plugin will add the
user id to the data layer but in my
example let's pretend that i'm dealing
with a custom platform therefore i ask a
developer to push the user id to the
data layer once your developer
implements the user id and pushes that
to the data layer here is how you can
check whether that is done properly you
can go to google tech manager click
preview
and then in this window you will be
asked to enter the url of the website in
my case i will enter the url of my login
page
then click connect
and a new tab will open that says
connected now i will log in with my
account click login and this is my
account now i should go to google tech
manager and one of the events right here
should be something related to login or
user data or whatever you have asked
your developer to push in my case that
event is called login i can click it and
then i can expand this api call so i can
click it right here and i will see two
parameters one is event login and the
other one is user id this is what i need
in order to implement user id tracking
in google analytics for but keep in mind
that your developer cannot place
anything he or she wants in this field
according to google's terms of service
this field cannot include things like
email address social security number or
anything else that can easily identify
the person it should be some random
string or number that is stored in your
website's database so since i already
have the user id in the data layer now i
have to turn it into a variable in
google tag manager because you cannot
use the data in google tag manager
unless you create a variable in my case
the user id is stored as user id with
the upper case i that is why i have to
create a data layer variable for that
let's go to google tag manager variables
then scroll down to the user defined
variables section and then click new
click variable configuration data layer
variable and then here i have to enter
the name of the key that is in the data
layer and in my case that is user id
with the uppercase i this is case
sensitive double click it copy and then
paste it right here then i will name
this variable here i can enter whatever
you want however here it must be exactly
as it is in the data layer if you have
something else like user underscore id
or id or something else then you must
enter that particular name right here
click save
now let's go to tags and as i've said
earlier in this video i presume that you
already have at least google analytics
for configuration tag in your container
click it
then click this pencil to edit the tag
and then click fields to set click add
row and here you should enter user
underscore id exactly like this this is
the parameter that google analytics 4
expects when it comes to user id
tracking and in this field you should
insert the data layer variable that you
have just created to insert the variable
click this button and then keep looking
for your data layer variable in my case
this is it i will click it and it will
be automatically inserted in this field
click save
if you have multiple google analytics
for tags for example event for purchase
event for click event for something else
and all of those tags are using the same
ga4 configuration tag those tags will
automatically inherit this parameter now
let's test whether this is working
properly click preview button to refresh
the preview mode here i am on the login
page once again i will log in and here
in tag assistant i will see that on the
container loaded event that fired after
the user id was pushed to the data layer
i will see if my tag fired i click it
and i see that one of the fields is the
user id and here is that field's value
now let's test whether this is working
properly and whether user id was
received by google analytics 4. you can
do that by going to google analytics
then configure and debug view and here
you will see a stream of information
that was sent to google analytics for
and one of those things is user id user
id is highlighted like this and if for
example you click on the page view you
will see some event information and also
you will see user properties and you can
click and here is the user id that was
received by google analytics 4. keep in
mind that ga4 is currently under heavy
development therefore some things in the
interface might change and you might see
some differences between my video and
what you see in your interface but don't
panic and keep looking because
eventually you will see the information
somewhere right here and if you still
struggle then take a look at the
description of the video or maybe in the
comments because i might have mentioned
some updates there when you have tested
everything then go to google doc manager
click submit to publish these changes
for example you can name something like
user id in ga4 and click publish within
the next 24 hours you will start seeing
some user id related information in your
google analytics 4 interface let's take
a look at several places where you can
find that user id information for
example here i am in one of the standard
reports in this case that is the event
report and then i can take a look at how
many visitors on my website were tracked
with the user id feature and how many
were not because only part of the
traffic has actually logged into their
accounts in this report i can click on
edit comparisons right here or i can
click add comparison right here and then
as one of the dimensions i could select
signed in with the user id and then in
this field you should select yes thanks
to this comparison i will see the data
that is coming from users who have
signed into their accounts and with
their events i was also sending the user
id click apply and here you will see all
website visitors and only a small
fraction has actually logged in because
well most of my website visitors are
just reading blog posts and they are not
students of my courses then another
place where you can find user id
information is in the explore section so
click there and then keep looking for
the user explorer click it
and here you will find a list of all
users and visitors of my website those
ids that contain a dot like this they
are not logged in this is a regular
google analytics client id that ga gives
to any visitor and those ids are
generated randomly however those shorter
ids like this one they are coming from
my database and these are the users who
have logged into their course accounts
but we are not done yet because if you
want to use the user id dimension in
other reports for example free form
exploration unfortunately you won't be
able to do that because user id even
though you send it to google analytics
is not available as a standalone
dimension let's take a look for example
here i have a new free form exploration
and let's say that i will just add i
don't know let's say event count metric
and then in the dimensions section i
want to add the user id so if i click
this plus icon and then keep looking for
the user id i will not find anything
right here if you want to use the user
id as a dimension in your other reports
you must create a separate user-scoped
custom dimension in google analytics for
to do that first you have to send user
id not only as well actually user id but
also as a separate custom dimension and
to do that you have to go to google tag
manager then go to tags click on your
configuration tag and here we are going
to send it as a user scoped custom
dimension and to do that you have to
click on user properties add row and
then add some parameter name that is
named anything else except the user id
because user id as a parameter is
reserved and you cannot create custom
dimensions for user id written like this
but you can do something like user id
dimension for example this will work
just fine and here in the value you can
enter the same thing that you used right
here now click save and then in google
analytics you have to go to configure
custom definitions then create custom
dimensions and then enter user id you
can enter any name right here it can be
something like crm id internal id
whatever you want then the scope must be
user you can enter or leave this field
empty i mean the description and then in
the user property you have to enter that
very exact parameter name that you used
in the configuration tag right here in
my case that is user underscore id
underscore dimension
i will copy it
and paste it right here then click save
and within the next 24 hours you will be
able to use that user id in your
exploration reports as well now let's
test whether this is working properly so
click the preview button in your google
doc manager container
the page reloads i will log in once
again then i see that my page view tag
or in other words configuration tag has
fired the user id needed for the user id
feature of google analytics 4 and this
is my user property that i will see as a
user scoped custom dimension in google
analytics 4. now let's go to ga4
configure debug view and here i can see
my user scoped custom dimension if i
click on the page view now i see that
there are two user properties one is
user id needed for the user id feature
and this is for my user scope custom
dimension i wish that this part was more
straightforward meaning that it would be
just enough to have the user id and this
would be available as a dimension in
google analytics 4 automatically but
right now this looks like the only
viable workaround for the situation and
when the next day comes you should be
able to use that dimension right here by
clicking the plus icon in the
exploration then enter user id click
this check box click apply and then you
will see some data right here oh
actually i forgot to add that user id to
the rows and the reason why i'm still
seeing not set right here is because i
have just created that dimension still
not enough time has passed in order to
process this data properly so from
tomorrow you will start seeing some data
in this column after you have checked
everything and you are sure that this is
working properly publish your container
by clicking submit and then complete all
the other steps that are necessary and
that is how you can implement user id
tracking on a website with google
analytics for remember you have to
include the user id with every event
that you send from your website to ga if
you found this video useful hit the
thumbs up button below the video because
it helps me continue working on this
channel also if you want to learn more
about google tech manager or google
analytics 4 consider subscribing to this
channel my name is julius this is
analytics mania and i'll see you in the
next video
[Music]
you
Ver Más Videos Relacionados
1.2 How Google Analytics collects and processes data - New for GA4 Analytics Academy on Skillshop
COSA CAMBIA DAVVERO? GA3 vs GA4 💥 DATA MODEL
Google Tag Manager Tutorial - Getting Started (Plus The NEW Google Tag)
شرح جوجل سيرش كونسول - ١ : تعلم سيو بالعربي : نديم حدادين
1.4 Set up website data collection for Google Analytics - New GA4 Analytics Academy on Skillshop
Introduction to Google Analytics - Bryan Phelps
5.0 / 5 (0 votes)