Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parameter format when tracking Google Analytics events with server side request automation

I'm currently in the process of programming an utility which generates GA tracking pixel (utm.gif) URL:s based on given parameters. For those of you who are wondering why I'm doing this on the server side, I need to do this server side since the context which I'm going to start tracking simply doesn't support JavaScript and as such ga.js is completely useless to me.

I have managed to get it working otherwise quite nicely but I've hit a snag: I can't track events or custom variables because I have no idea how exactly the utme parameter's value should be structured to form a valid event or var type hit. GA's own documentation on this parameter isn't exactly that great, either.

I've tried everything from Googling without finding anything (which I find ironic) to reverse engineering ga.js, unfortunately it's minified and quite unreadable because of that. The "mobile" version of GA didn't help either since officially GA mobile doesn't support events nor vars.

To summarize, what is the format of the utme parameter for page hit types event and custom variable?

like image 694
Esko Avatar asked Apr 07 '10 09:04

Esko


People also ask

How are events tracked in Google Analytics?

How does Google Analytics event tracking work? A snippet of custom code is added to the link code on the items you want to track on your website and when the item is clicked, the element is tracked and displayed as an event in Google Analytics.


1 Answers

I have not tried this myself but by reading your GA documentation link and the GA Event Tracking Guide. Then the equivalent code to:

var pageTracker = _gat._getTracker("UA-xxxxxx-x");
pageTracker._trackEvent('my_category', 'my_action', 'my_label', 'my_value');

would result in a utme parameter like (I am not sure if this needs to be encoded but it couldn't hurt):

utme=5(my_category*my_action*my_label)(my_value)
like image 197
Mark McLaren Avatar answered Nov 09 '22 18:11

Mark McLaren