jsj
jsj

Reputation: 9381

Is the Client ID in Google Measurment Protocol mandatory when User ID is used?

The Google Measurement Protocol documentation claims that the cid is optional if uid is used:

This field is required if User ID (uid) is not specified in the request

So I make the following requests to measurement protocol:

GET https://www.google-analytics.com/collect?v=1&tid=<MY_TID>&aip=1&uid=<USER_ID>&ec=Foo&ea=Bar&el=Baz

But they do not get recorded in Google Analytics.

I make other requests where I specify both uid and cid and they work perfectly. Is there something I am missing? Elsewhere I have read that cid is actually mandatory.

EDIT: SOLUTION

This Answer is a correct answer to my question, so accepted. But I wanted to add that in addition to the fact that these hits were never going to show up in the Main View (only the User ID view), I had neglected to set t=event in my request (necessary for ec, ea and el). The debug endpoint didn't help diagnosing this I just stared at it (and the docs) for long enough to see it.

Upvotes: 1

Views: 170

Answers (1)

Michele Pisani
Michele Pisani

Reputation: 14179

It is mandatory because if you don't send it but you send only uid, the hit will be appear only in USER-ID view.

Upvotes: 2

Related Questions