Parameter format when tracking Google Analytics events with server side request automation
I'm currently in the process of programming an utility which genera开发者_StackOverflow中文版tes 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
?
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)
精彩评论