Legacy How to add User-ID with Google Analytics option

Status
Not open for further replies.

subaruclub

Customer
Hi,

I am taking advantage of using DBSEO to handle putting the Google Analytics code into my site.

It seems to be working just fine.

I am using the new Universal Tracking Code.

I also want to enable the User-ID feature when using the Universal Tracking Code.

It requires me to add this line to the Google Code:

ga(‘set’, ‘&uid’, {{USER_ID}}); // Set the user ID using signed-in user_id.


Can you tell me what I need to edit in order to insert this into the code that your product is injecting to the forum?


Thanks,

D.
 
Upvote 0
This suggestion has been closed. Votes are no longer accepted.
There is currently no option to add custom GA code anywhere.

What is that code used for?
 
Well,

That one, not so much.

But this was the one I was mainly concerned about:

ga('require', 'displayfeatures');



It needs to be inserted between:

ga('create', 'UA-17539572-10', 'auto');

It goes here

ga('send', 'pageview');


In the google code.


This allows for demographic tracking.

D.
 
I'll be sure to add these as optional features in the next version of DBSEO :)
 
I'll be sure to add these as optional features in the next version of DBSEO :)


Awesome! Thanks... looking forward to it.


I had to stop using the function of having the product put the code in for me.

I put the code in my style template instead in the meantime.

D.
 
Thank you very much for adding this functionality to the product.

I have implemented it on my site today.

I will check Google tomorrow and see if it is returning the data as expected.


You guys absolutely rock!

D.
 
Doing some further research I learned that a further tweak needs to be made to the implementation.

For this code that gets inserted:

ga(‘set’, ‘&uid’, {{USER_ID}}); // Set the user ID using signed-in user_id.

The "USER_ID" is actually a string that is unique and needs to be changed to pull a variable from vb

so, the product needs to be modified in this way:


USER_ID needs to be modified to be the vBulletin "username" code

ga(‘set’, ‘&uid’, {{{vb:raw bbuserinfo.username}}}); // Set the user ID using signed-in user_id.


I think ;)


D.
 
That already happens.
PHP:
$_extraParams[] = "'userId': '" . intval($GLOBALS['vbulletin']->userinfo['userid']) . "'";
 
hmmm... interesting.

Google doesn't seem to be picking it up... or I am not understanding how they are interpreting the data.

I was expecting to see reports that listed the usernames in google.

I will keep digging... unless you know what I need to do...

D.
 
I'm not sure if it actually is intended to display anything different in the analytics, I think it's more a case of more accurate session numbers and such. I could be wrong, though.
 
I'm not sure if it actually is intended to display anything different in the analytics, I think it's more a case of more accurate session numbers and such. I could be wrong, though.

I think you are right.

In comparing the analytics between USER_ID and non USER_ID reports I see that the USER_ID report is much more accurate in terms of not reporting "non-account" or "not-logged in" users.

On my site "guests" can view the site but not post etc. So, obviously they have no "username".... but those that do have usernames and are logged in are captured by this field and reported against.

What I THOUGHT that this feature of google analytics would do is actually capture what the user_id was and give me reports on an individual user basis.

i.e.

"MEMBER1" logged in 12 times and visited these pages, is from X, came back X times, etc.

"MEMBER2" logged in 3 times and visited these pages, is from this part of the world, and all those other fancy metrics

I am going to let it run for a while longer and do a full comparison of a particular days report against the user_id report and see what the differences are.

D.
 
Status
Not open for further replies.
Back
Top