views:

26

answers:

1

Hi, I don't quite get how to use the visitor level variables. Do I need to put them in some sort of condition to determine if the visitor is a repeat visitor, or do I just use the _SetCustomVar method like I would the page or session variables?

+1  A: 

Google Analytics will determine if someone is the same visitor based on the presence of its cookies. So, to the extent that GA is able to differentiate Visitors (ie, same computer, same browser as past visits without having removed cookies), the custom variable will persist.

All you need to do to set a variable as 'visitor' is to set the fourth parameter (scope) to 1.

Just be sure to set the custom variable before your page-view call, otherwise the custom variable data doesn't get sent to Google.

yc
So I don't need to check if a cookie exists before setting the variable?
chobo
It's not a 'repeat-visitor' cookie. It won't overwrite itself if you try to set it multiple times, as long as you're setting the same variable value in the same variable 'slot'. ie, lets say the visitor level variable is called 'Logged in', and its set in slot 1 at the moment someone logs in. When that's called, all of their future actions (on that browser, with those cookies) will be associated with that variable. The only way that ceases to be the case is if you call the unset variable method, or you try to put a new variable with a different name for that user in slot 1.
yc
(Yes, you don't need to do any cookie checking. GA handles that for you.)
yc