Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom dimensions not tracked in Google Analytics HTTP requests (Measurement Protocol)

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"}
like image 394
Xevi Pujol Avatar asked Jan 09 '23 18:01

Xevi Pujol


1 Answers

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

like image 173
lossleader Avatar answered Mar 22 '23 08:03

lossleader