I want to remain using Universal Google Analytics outside of Confluence (rather than using a plugin).
My wiki is for employees and requires login, so I am in compliance with the User-ID policy as far as I can tell. My users login via an LDAP directory.
I'd love to be able to track who has viewed what.
I think I need to add a USER_ID to this code, but I'm not sure which one to use. I've tried global variables: $current_user_email and current_user_email
ga(‘set’, ‘&uid’, {{USER_ID}}); // Set the user ID using signed-in user_id.
Additionally, the &uid portion of the GA tracking code is throwing an error in my theme.
This is not currenty possible while complying with Google Analytics terms of service.
In your example, the {{USER_ID}} variable must be set using valid JavaScript. For example like so:
var userId = 'some value'; // you need to populate this ga('set', '&uid', userId);
David Simpson discusses how to achieve this (and importantly how not to achieve this) in Identifying your users in Google Analytics while complying with section 7 of the terms of service.
He is currently suspended from Atlassian Answers, so perhaps ask your question out in the open at Stack Overflow instead.
Also, don't add this into your theme. Stick it in the Custom HTML instead.
Gary,
I found a few resources that might be helpful:
http://davidsimpson.me/2009/03/18/tracking-atlassian-confluence-usage-with-google-analytics/
http://davidsimpson.me/2013/10/17/identifying-your-users-in-google-analytics-while-complying-with-section-7-of-the-terms-of-service/
Cheers,
Stephen Brannen | Confluence Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The following code works for me (userId represented by 32-digits key):
ga('create', 'UA-xxxxxxxx-1', 'auto', {
userId: '$userAccessor.getUserIfAvailable($req.remoteUser).getKey()'
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.