1

I'm using the Measurement Protocol to push e-commerce events to GA4 and it works well. However, some time ago, I noticed that all transactions are marked as desktop (even those that were actually placed from a mobile device).

Is there a way to set device information (namely 'Device Category') when sending an event? In GA3 it was possible to achieve this via user-agent passing, but this does not seem to be relevant for the new analytics.

I tried experimenting with different GET parameters (like ua) when sending an HTTP request, but it didn't work. Example: https://www.google-analytics.com/mp/collect?measurement_id=GA_MEASUREMENT_ID&api_secret=GA_API_SECRET&ua=UserAgentString

2 Answers 2

3

The measurement protocol for GA4 is extremally limited. You cant set Device Category nor does it let you set user agent.

This is still in beta we just need to wait and see if they open it up more.

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks for clarifying! Do you think it is possible to collect device info using custom definitions?
Yes you could but it probably wont show up in the standard reports as anything more then a custom dimenison.
It's a shame that a "modern" product doesn't provide basic features that we have had in UA for years.
Here is the official confession from Google for the lack of this feature: developers.google.com/analytics/devguides/collection/protocol/…
1

Create a custom definition called "device" and pop that bad boy in your call like so :

{
        client_id:,
        events:    [
          {
            name:,
            params: {
              engagement_time_msec:,
              user_agent:,
              device:, # <---- Boom!
            },
          },
        ],
      }

1 Comment

The problem with this approach is that you end up with two different "Device" Dimensions: one default and one custom. If you want to filter ALL your events (i.e. including the ones that were sent via Measurement Protocol) by Device, then you need to set two different filters. Of course, better than nothing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.