When using analytics.js, I can successfully track events including custom dimensions this way (as described in the docs):
ga('send', 'event', 'category', 'action', {
'metric18': 8000,
'dimension6': 'crocodile'
});
However, when using the Measurement Protocol (ie. HTTP requests), I can't seem to find the way of including custom dimensions and metrics to the event tracking, as I haven't found any reference in the documentation.
This is what I've tried so far (based on the examples found in the documentation). In both cases, the event has actually been tracked, but without any custom dimensions or metrics associated.
http://www.google-analytics.com/collect?
v=1 // Version.
&tid=UA-XXXX-Y // Tracking ID / Property ID.
&cid=555 // Anonymous Client ID.
&t=event // Event hit type
&ec=video // Event Category. Required.
&ea=play // Event Action. Required.
&metric18=8000
&dimension6=crocodile
and
http://www.google-analytics.com/collect?
v=1 // Version.
&tid=UA-XXXX-Y // Tracking ID / Property ID.
&cid=555 // Anonymous Client ID.
&t=event // Event hit type
&ec=video // Event Category. Required.
&ea=play // Event Action. Required.
&el={"metric18":8000,"dimension6":"crocodile"}
Based on the collection devguide you are using the wrong parameter names, please try:
http://www.google-analytics.com/collect?
v=1 // Version.
&tid=UA-XXXX-Y // Tracking ID / Property ID.
&cid=555 // Anonymous Client ID.
&t=event // Event hit type
&ec=video // Event Category. Required.
&ea=play // Event Action. Required.
&cm18=8000
&cd6=crocodile
(The part of the devguide you were looking at is for the web tracking JS instead of collection.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With