Setting up cross-device tracking with GTM

If you use user authentication, loyalty programs, or at least dynamic remarketing on your site, then you should already be familiar with such a concept as User ID. We choose a login and a regular userd id, which is assigned during registration, since this is the most popular option.

We decided to find the simplest and fastest way to implement cross-device tracking on the client’s website and used GTM, as always

What must be done, in order:

  1. Include User ID in Google Analytics and create a separate view.
  2. Create a new custom dimension for User ID.
  3. Generate User ID push and add it to data-layer.
  4. Pull User ID from data-layer using GTM.
  5. Send User ID data to Google Analytics using GTM.

Let’s start in order with the simplest. We go into our Google Analytics, go to the admin panel and in the resource column we find: tracking code – >> user-id:

Go to the section and enable user tracking:

Be sure to enable session pooling, since this will allow you to associate with identifier hits that were received before the User-ID was assigned.

And finally, we create a new view for the User-ID, in which we will view statistics. The view can be used as an auxiliary, but not the main one. In the new view, you will have a cross-device section:

Now we need to create a custom dimension to pass our User ID parameters:

In the current data layer on the site (most likely you already have it), add another parameter that will transfer the value we need. The parameter should be processed when the user is authorized. It will look something like this:

See also  What is Google My Business and how can I get the most out of it?

dataLayer.push ({

‘userID’ [userid],


Now we need to set up the GTM side. Here, too, everything is extremely simple. Add a new variable, let’s name it “Pull user id from data layer”:

And we set up a new tag. The tag will work on all pages, we set the following conditions:

We publish the tag and after a while we will be able to track the metrics in Google Analytics in the following form:

Lane Derrick

My name is Lane Derrick, back in 2014, he began to take an interest in SEO and webmastering, and started real projects six months later. For 6 years of practice, skills were formed that I use to this day. The main activity is website promotion and contextual advertising.

Leave a Reply

Your email address will not be published.