K
K
KamilFo2014-06-16 14:45:48
Google Analytics
KamilFo, 2014-06-16 14:45:48

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; ?>);

Am I writing the code to fix the ID correctly?
How to further configure this in UA and how to view this variable in the context of all visits?
I would be very grateful for any hints and especially a small tutorial, as I already got confused in these custom dimensions, custom variables, etc.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ruslan, 2014-06-16
@KamilFo

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; ?>');

For persuasiveness, you can use the code on all pages, in order to avoid accidental losses and overwriting.
3. Enjoy. Immediately, or using custom reports and dashboards
PS I have been using this thing for the last year. Recently, a certain UserID appeared in UA as a separate option (perhaps you mean it), perhaps there is a little differently.
PPS In general, Google Tag Manager would not interfere with such tasks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question