2

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);
_gaq.push('_trackPageview');

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

3

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.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy