Learn business growth with Google Analytics 4 Forums Google Analytics 4 Troubleshooting the issue of (other) language in Google Analytics 4 during migration from Universal Analytics

  • Troubleshooting the issue of (other) language in Google Analytics 4 during migration from Universal Analytics

    Posted by Isabella on 3 September 2022 at 3:49 am

    So here’s the deal: I’ve been using a couple of code snippets to set the language for visitors on my site. The first snippet does just that – sets the language. The second one does the same but also throws a “page_view” event into the mix:

    gtag('set', 'language', 'client language');
    
    gtag('event', 'page_view', {
        page_title: 'PAGE TITLE',
        page_path: 'PAGE PATH',
        page_location: window.location.protocol + "//" + window.location.hostname,
        language: 'client language',
    });
    

    Everything was running smoothly until I transitioned from Universal Analytics to Google Analytics 4. Now, for some reason, Google Analytics 4 only shows “(other)” as the visitor’s language. To illustrate, here’s what it looked like before and after the switch:

    [Universal Analytics screenshot](https://i.stack.imgur.com/K27aJ.png)
    [Google Analytics 4 screenshot](https://i.stack.imgur.com/59AeL.png)

    I’ve tried using ISO 639 language codes in case the issue was due to non-standard language names but no dice. Any idea what might be causing this and how to set the language via code for Google Analytics 4? Because I’m stumped.

    Jacob replied 11 months, 2 weeks ago 3 Members · 2 Replies
  • 2 Replies
  • Isabella

    Member
    28 November 2022 at 3:10 am

    Hey, I checked out Google’s documentation on “[Automatically collected events](https://support.google.com/analytics/answer/9234069)” and it turns out that these parameters: language, page_location, page_referrer, page_title, and screen_resolution are actually collected by default with every event. So, you might not need to write any additional code. This could be why ‘language’ is being overwritten.

    Also, for the Page-View, it should be automatically logged if you turn on the ‘Advance Measurement’ feature. So, your best bet might be to remove the additional codes you’ve added. Here’s an image to help you find and toggle on ‘Advance Measurement’: [Link](https://i.stack.imgur.com/cO8na.png)

    Hope this helps, mate!

  • Jacob

    Member
    24 December 2022 at 1:21 pm

    The issue here seems to be due to the transition from Universal Analytics to Google Analytics 4. In Google Analytics 4, the method for tracking user language has changed and it doesn’t appear to support the “set” command anymore. Instead, Google Analytics 4 now auto-tracks user language using the browser’s language setting, and the ‘language’ parameter is not a recognized parameter in a ‘page_view’ event. One workaround for this might be to create a new event specifically for tracking your custom ‘language’ parameter, and then create a custom definition for ‘language’ in the Google Analytics 4 interface. However, be aware that Google might still categorize some data as “(other)” if it doesn’t meet their data thresholds or quality standards. A more technically complicated but more reliable way would be pulling the client’s language information directly from the browser’s Navigator API and sending it as a custom parameter in your GA4 events. Documentation on how to track customized data with Google Analytics 4 could also provide more guidance.

Log in to reply.