Konstantin Solovev
Konstantin Solovev

Reputation: 21

Can I generate a random `client_id` in GA4 event if `user_id` is already included?

According to the Google documentation, a valid http request with a GA4 event (measurement protocol) must contain client_id.

I already include user_id in every event, so including client_id in every event seems unnecessary.

If I generate a random client_id will something go wrong?

I found no information about this in Google Analytics help center.

Upvotes: 1

Views: 1034

Answers (1)

Oleg Rasskazov
Oleg Rasskazov

Reputation: 51

I've just found a problem with random generated client_id - GA does not axcept it. At least if send to GA4 debugger (debug_mode=1) 2 events, one of the with a real client_id (like xxxxx.xxxxx) and another the same event but with random client_id - Debug View shows only the first one.

According to GA4 MP doc (https://developers.google.com/analytics/devguides/collection/protocol/ga4/reference?client_type=gtag#payload_query_parameters) client_id is required and user_id is optional so you have to send client_id anyway. But impossibility to send some custom client_id is something new for me. Proceeding investigation...

Upvotes: 5

Related Questions