Answer the question
In order to leave comments, you need to log in
How do I set up a user ID to be passed to Universal Analytics?
Hello!
There is no way to transfer and set up a custom variable in Universal Analytics.
There is a site that generates a special visitor ID on each visit and puts this variable in cookies.
When generating this variable in the UA counter code, ga('send', 'pageview');
I put the code before the line
<?php $idGA = XXXXXX; ?> //условно
ga('set', 'userID', <?php echo $idGA; ?>);
Answer the question
In order to leave comments, you need to log in
1. You only need custom dimensions (more precisely, I always used ClientID through them)
2. It would be desirable to put your ID in single quotes.
Brief tutorial:
1. Create a custom dimension with scope "User" (there are also Hit and Session, I don't remember how in Russian). Let's imagine dimension has index 1.
2. Change your code to:
<?php $idGA = XXXXXX; ?>
ga('set', 'dimension1', '<?php echo $idGA; ?>');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question