GA4 Measurement Protocol returns events not the users
Asked Answered
C

2

10

We've set Google Analytics GA4 event transfer via Measurement Protocol. We followed documentation fully - https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events?client_type=gtag

Everything was fine in test GA counter, but after moving on production counter events stopped getting into interface (though keep being sent to connected Google BigQuery).

To be clear, we can see that events are counted, but not users.

0 for users, 25 for events

We changed only API secret and Measurement ID in our configuration. The major difference between test and prod counters: production is linked to Google AdWords and GoogleBigQuery.

Would be very grateful for any ideas and insights in that case.

Capitalism answered 21/10, 2021 at 7:58 Comment(2)
Please provide enough code so others can better understand or reproduce the problem.Cnut
The code we're using almost copies the one provided in the manual: const measurement_id = G-XXXXXXXXXX; const api_secret = <project_api>; fetch(google-analytics.com/mp/collect?measurement_id=${measurement_id}&api_secret=${api_secret}, { method: "POST", body: JSON.stringify({client_id: 'XXXXXXXXXX.YYYYYYYYYY', user_id: 'id-XXXXXX' , events: [{name: 'account_activation', params: {},}]})});Capitalism
M
12

I have same problem. You need to set engagement_time_msec parameter.

For example:

"engagement_time_msec": "1"

More: https://support.google.com/analytics/thread/117981433/events-sent-from-measurement-protocol-do-not-set-active-users?hl=en

The Measurement Protocol V4 is for GA4 properties(which is also the one you are using).

According to the official document: https://support.google.com/analytics/answer/9408920 It says "Google Analytics 4 properties counts users who engaged with your app/site for any non-zero amount of time during the previous 30 minutes".

GA4 uses "engagement_time_msec" parameter to identify user interaction time. This explains why you can see the number of events but not the number of users. If you want users sent from MP to be counted as active user, simply add the "engagement_time_msec" parameter to your event.

Muir answered 15/3, 2022 at 12:49 Comment(0)
M
0

I think this is "by design". Even this screenshot in the official docs shows Users in last 30 minutes: 0 https://developers.google.com/analytics/devguides/collection/protocol/ga4/verify-implementation?client_type=gtag#realtime

As far as I can tell it's not possible to enable Session Hits Count for events triggered via the new measurement protocol (or whatever is necessary to get active users/sessions).

It might be possible to find a workaround for this issue:

Mastat answered 13/11, 2021 at 13:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.