L
L
lexstile2017-05-15 14:48:00
Google Analytics
lexstile, 2017-05-15 14:48:00

How to get and check google user_id?

Created a user_id view in the LC.
Connected custom analytics.
How to write user_id? How to check a record?

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 
 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 
 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 
 })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); 

 ga('create', 'UA-26374176-5', 'auto'); 
 ga('create', 'UA-26374176-5', { 'userId': 'USER_ID' });
 ga('send', 'pageview');

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Agapov, 2017-05-25
@lexstile

1) you are not passing the user_id correctly. According to https://support.google.com/analytics/answer/312366... ​​you need to pass the set parameter
In this case, {{USER_ID}} is what your server should be generating. And it's easy to check. Log in and open the Code Inspector. This parameter must be filled with a value.
2) You can check the sent data using the Google Tag Assistant plugin. It shows what variables and with what value were transferred to GA
And general advice - go to Google Tag Manager, it's more convenient. And debugging is easier.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question