Sam
Sam

Reputation: 185

setting up user_id for Google Analytics

I followed the directions given when setting up the User-ID option.

I then created a view named 'user_id' for showing user_id info, but I am not seeing anything. When enabling User-ID, the code said to add the following to my tracking code.

gtag('set', {'user_id': '12345UserIdHere'});

However, when I go to the 'user_id' view, nothing is shown.

My current goal is to view which user ids were browsing the system during a given period of time.

Edit: I am using this library: https://www.googletagmanager.com/gtag/js?id=MY-ID-STUFF

Upvotes: 0

Views: 1316

Answers (1)

Eike Pierstorff
Eike Pierstorff

Reputation: 32760

I mostly used GTM, so I am not completely familiar with the gtag.js syntax, but I don't believe it has a "set" method. According to the documentation you'd have to set the user id in the "config" call instead:

gtag('config', 'GA_MEASUREMENT_ID', {
  'user_id': 'USER_ID'
});

(Things in caps are placeholders).

Upvotes: 1

Related Questions