Learn business growth with Google Analytics 4 Forums Google Analytics 4 Inconsistent Format Displayed for Custom Dimension in GA4

  • Inconsistent Format Displayed for Custom Dimension in GA4

    Posted by Amit on 18 August 2022 at 1:56 pm

    Hey guys, I’m working on migrating to GA4 and I’ve hit a snag. We’ve got a custom dimension that takes a number value with 37 digits, and it’s showing up in an exponential format in our real time report, custom report and the app that gets the data. Here’s what I mean:

    What we should see: 86594184624443841463509305394505323179 
    What we actually get in GA4: 8.65941846244438E+37 

    Weirdly, this isn’t an issue with UA, we get the raw value without any conversion. Can anyone shed some light on why this is happening in GA4 and how we can fix it? Thanks a ton!

    Michael replied 11 months, 2 weeks ago 3 Members · 2 Replies
  • 2 Replies
  • Elizabeth

    23 November 2022 at 8:11 pm

    The issue you’re encountering with GA4 is a known bug. The system is mistakenly converting your 37-digit number value into an exponential format. A simple workaround is to add a non-numeric symbol, like a dot, at the end of your number value, such as 86594184624443841463509305394505323179.

    When I’m sending a Client ID to GA4 as a custom dimension, the same thing happens – it transforms it to a number. So, I just add a dot at the end and then manually remove it in the exported reports. I know it’s not ideal, but until the bug is fixed, this should allow you to view your data correctly.

  • Michael

    25 February 2023 at 2:14 pm

    The issue you’re encountering with GA4, where long numbers are being displayed in an exponential format, likely stems from the way JavaScript handles large numbers. JavaScript uses floating-point arithmetic which is not suited for large integers and as a result, very large numbers often result in scientific notation when handled by JavaScript. This might be altering the format of your custom dimension.

    A potential workaround may be to convert the numbers into strings before sending them to GA4. Alternatively, if you’re using these large numbers as unique identifiers, consider using a UUID (Universally Unique Identifier) generator that gives shorter string values.

    However, please note that GA4 natively doesn’t support a 37 digit number as a distinct value. It officially supports a numeric value range of ‘±9.22*10^18’ for ‘event_bundle_sequence_id’ and ‘user_pseudo_id’. For ‘event_params’, the numbers’ limit is ‘±2^53’. This limit is set due to the floating-point double precision number limit in JavaScript.

    You may want to re-consider the design of your event data structure and choose a more feasible way to represent your number.

Log in to reply.