Eugene Krall
Eugene Krall

Reputation: 563

Google Analytics 4 Attribution doesn't work with Measurement Protocol

So i followed this guideline and provided session_id with my events sent via Measurement Protocol:

https://developers.google.com/analytics/devguides/collection/protocol/ga4/changelog

The call to the GA4 looks like this:

https://www.google-analytics.com/g/collect?_uip=94.130.16.0&cid=FyUhzUxsZk1lmTvaiXL6wdzkTkayf1nFrgxhrqt3ZR4%3D.1666013832&tid=G-46NQ594GKJ&v=2&gtm=3fesab1&uid=8151454&sid=1666013831&ep.method=sendpulse.ua&ep.service=smtp&ep.x-fb-ck-fbp=fb.1.1666013831656.1127632427&ep.x-fb-ck-fbc=&ep.session_id=1666013831&en=registration%20submission

And I can clearly see that that it's correctly passed with events by looking at the raw data and comparing it with the raw events generated by the official script.

Event sent from backend: enter image description here Event sent by the official JS library: enter image description here

Still, all the events sent via Measurement Protocol aren't attributed to their sources and simply shown as "Unassigned" in the reports.

Honestly, at this point I am about to give up on GA4 and move to something else. While the concepts of new GA are on the right track, everything seems to be broken and poorly documented at this point and I've been trying to make attribution work for quite a while now but to no avail.

Upvotes: 1

Views: 885

Answers (1)

Skatrix
Skatrix

Reputation: 139

GA4 MP is absolutely different than UA MP.

  • It doesn't accept GET requests, only POST
  • The request body should be formatted in JSON
  • It requires Secret and Measurement ID

It looks like you're trying to simulate GA4 client side behavior from the back end, and it isn't supported. To report events from the server side you have to use GA4 MP API which is Json based and requires secret and measurement id.

Please refer official google docs regarding GA4 MP to send events from the server side. https://developers.google.com/analytics/devguides/collection/protocol/ga4/

Upvotes: 0

Related Questions