I think what I want is so simple but I can't figure it out.
I have a form that visitors can fill out on the site. I want to do two things with this form:
I know how to set a goal and I know how to set a dimension but how can I do both on the same submission? I tried chaining them like this:
<input type="submit" onclick="javascript:_paq.push(['trackGoal', 1]); _paq.push(['setCustomDimension', customDimensionId = 1, customDimensionValue = 'TestValue']);">Submit</button>
But that doesn't work.
If I take the custom dimension off, I can trigger the goal. However, I can't seem to set the custom dimension value from the button. I can set it if I put _paq.push(['setCustomDimension', customDimensionId = 1, customDimensionValue = 'TestValue']);
in the footer - but that's it.
I've also read this: http://developer.piwik.org/guides/tracking-javascript-guide#custom-dimensions but none of those examples work for me.
What am I missing?
Per the piwik crew: the proper way to track a goal and a dimension is this:
_paq.push(['trackGoal', idGoal, customRevenue, {dimension1: 'DimensionValue'}]);
I was having trouble at the time because the docs were not up to date. They seem to be now.