Having trouble with custom variables

I’m new to Piwik but so far very impressed. I’ve recently been adding some tracking to a very simple Backbone app and have run into some difficulty around custom variables.

This app is running in an environment where I can name the clients ( and that gets exposed in another javascript object ) and want to pass that name up. So no problem right, custom variable. So I did the following in the router initialization:

      window._paq.push(['setCustomVariable', 1, "Client", kioskID, "visit"]); 

and then later something like:

        window._paq.push(["trackPageView", '/trend/tap/'+ pid]);

For just simple brute force sake I’ve gone ahead and replicated the setCustomVariable command directly above a couple of the trackPageView calls and I’m still not seeing them tracked. Also I’ve changed between ‘visit’ and ‘page’ just for grins, still no joy.

and I’m not seeing anything under the visitors > custom variables tab in the analytics interface. Though I am seeing the title getting tracked properly

Any suggestions? We’re running 1.11.1

it looks like it should work, can you post full code ?

Posting all the code is a bit … impossible. All the code that you need is directly above. Right now on a certain button I have this following:

 window._paq.push(['setCustomVariable', 1, "Client", kioskID, "visit"]);
 window._paq.push(["trackPageView", '/trend/tap/'+ pid]);

As this is a backbone app the button press does not reload the page, simply sets a state variable that all the views respond to, shuffling out of the way etc. Dubugging the JS shows that kioskID in this case is equal to “NotAKiosk” and pid is equal to 5486865, I get the page view track but nothing shows up under visitors > custom variables.

Tied to this MAY be another problem in that my Page URL is not defined.

I guess what I’m asking is what is the best way to debug this. What’s the best way to inspect the ASYNC tracking code in the browser. Is there a good way to debug the queue processor on the server end. etc.

see this guide for debugging: http://piwik.org/docs/tracking-api/reference/#toc-debugging-the-tracking-api-requests