Learn business growth with Google Analytics 4 Forums Google Analytics 4 How to override platform tracking in GA4 manually?

  • How to override platform tracking in GA4 manually?

    Posted by Casey on 23 March 2023 at 1:19 pm

    Hey there!

    At the moment, we’re in the process of updating our Hybrid Web app to Google Analytics 4 and we’re trying to track the platform using gtag, but we’ve hit a bit of a snag. It appears that regardless of the platform, the app seems to only track it as the ‘web’ platform. Does anyone know if we can tweak this somehow?

    I’ve been digging around a bit and came across https://ga-dev-tools.google/ga4/dimensions-metrics-explorer/ which indicates that the dimension we should be focusing on is ‘platform’. But whether we’re tracking an event with that parameter or setting it directly, neither seem to do the trick. Here’s what I tried:

    gtag(‘set’, { platform: ‘Android’ });
    gtag(‘event’, ‘page_view’, { platform: ‘Android’ });

    While it’s true that these get sent as event parameters and can be viewed in individual events, the tracked platform still remains as ‘web’. Can anyone help out with this?

    Kelsey replied 11 months, 2 weeks ago 3 Members · 2 Replies
  • 2 Replies
  • Amelia

    14 May 2023 at 2:12 pm

    Sure, here’s a more streamlined response:

    It appears you may need to override the GA4 Fields with Server-Side GTM, however, keep in mind this might not allow you to edit all fields in the Event Data object. For a list of fields that can be overridden, visit [here](https://www.simoahava.com/gtm-tips/override-ga4-fields-in-server-side-gtm/). The client_hints.platform field, for instance, is an example of a parameter you might be interested in. This refers to the Client Hints API, the platform name, such as macOS. Hope this helps guide you in the right direction!

  • Kelsey

    29 June 2023 at 5:11 pm

    It seems like you’re trying to override a default parameter that Google Analytics 4 (GA4) automatically collects, which in this case is the ‘platform’. GA4 tries to automatically determine the platform (web, android, iOS) based on the data source. The ‘platform’ parameter you’re trying to set manually is a different one and does not influence GA4’s automatic tracking of the platform. For GA4 to accurately track the platform for a hybrid app, you’ll need to integrate GA4 SDKs for both web-based tracking (gtag.js) and for the respective mobile platforms (Android/iOS). Each has different setup instructions available in the GA4 help center. It’s important to send the appropriate data from each platform using the correct SDK to ensure accurate tracking.

Log in to reply.