Onsite personalization example with Google Analytics

I have had quite a few requests to confirm that you can read custom variables so I thought I’d just show a quick demo. I also recommend you take a look at the video from the Google Analytics team that describes this feature (fast forward to around minute 29:00).

As the name implies _getVisitorCustomVar() only reads custom variables that have a visitor-level scope. You can’t use this approach for reading page-level or session-level custom variables, so the scope should be set to 1 when you set a custom variable. The argument in _getVisitorCustomVar(1); is the slot you use for setting the visitor-level custom variable.

Anyway, here is a simple demo where we set a custom variable on another page. Once the custom variable is set, it can be read and be used to execute code on other pages.

Please click here first to set the custom variable. Then come back to this page and see what happens.