4

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"}
Xevi Pujol
  • 557
  • 3
  • 14

1 Answers1

9

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.)

lossleader
  • 13,182
  • 2
  • 31
  • 45
  • Thanks for the answer, although I was indeed looking at the Measurement Protocol documentation, but wrong section (Dev Guide instead of Parameter Reference) – Xevi Pujol Oct 02 '14 at 11:12
  • @XeviPujol I guess I didn't write that clearly since they are both subsections of collection. But the link with 'collection/analyticsjs' is from the wrong subsection for measurement; you can really only trust the 'collection/protocol' section for specifics. At any rate, glad it solves the problem! – lossleader Oct 02 '14 at 11:45