Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Google Analytics custom variable to track the category for a product. Product A has 3 categories: catA, catB and catC. This changes at page level because we load different products on different pages.

My code snippet looks like this:

_gaq.push('_setCustomVar', 1, 'categories', 'catA', 3);

In order to set multiple categories, I need to send multiple _trackPageView or _trackEvent requests. Is there a way to overcome this problem?

share|improve this question

migrated from stackoverflow.com Dec 27 '13 at 2:14

This question came from our site for professional and enthusiast programmers.

up vote 2 down vote accepted

We got around this by string concatenating our tags together with a | delimeter. Some something like.

_gaq.push('_setCustomVar', 1, 'categories', '|catA|catB|catC|', 3); _gaq.push('_trackPageview');

Then you can search for the tag in the UI

search for catA in ui

Not ideal, but better than tripling up on events/pageviews.

share|improve this answer
That's a decent workaround, but hard to scale when you have categories > 10. Have you explored options to widen dimensions? support.google.com/analytics/answer/3191417?hl=en – sss Dec 25 '13 at 19:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.