Recording custom variables to identify individual users with Google Analytics
Posted
by
mrtsherman
on Pro Webmasters
See other posts from Pro Webmasters
or by mrtsherman
Published on 2011-11-10T21:53:10Z
Indexed on
2012/04/10
23:45 UTC
Read the original article
Hit count: 331
I have been asked by our marketing department to add Google Analytics custom variable tracking
to my company's website. As the website uses server side includes
, modifications to the tracking tag roll out globally - maintenance is therefore a headache!
So, if I add the following code (keeping in mind SSI so every page has the same code):
// visitor level tracking, id = 12345
// Record a unique id for each visitor. When they return also track this id
_gaq.push(['_setCustomVar', 1, 'id', '12345', 1]);
// page level tracking
// If the user signs up for our newsletter we set newsletter to true
// Each page they subsequently visit should also mark this as true
_gaq.push(['_setCustomVar', 1, 'newsletter', 'true', 1]);
I don't use GA and the marketing people don't use custom variables, so we don't actually know how or if this will work. Therefore my questions are:-
- Do I want
Page
,Session
orVisitor
level tracking? - What happens when the same code is used on every page?
- Can GA 'overwrite' a setting. For example, if I set newsletter to true on page X and then user navigates to page Y, will the variable also be marked there?
© Pro Webmasters or respective owner