Learn business growth with Google Analytics 4 Forums Google Analytics 4 Troubleshooting issues with GA4 purchase tracking tag

  • Troubleshooting issues with GA4 purchase tracking tag

    Posted by Lucas on 9 January 2023 at 6:25 am

    Hey, I seem to be having this issue with GA4 where my basic tag isn’t showing in my Google Analytics, even though it’s there, see:

    gtag("event", "purchase", '.yiihelpersJson::htmlEncode([
                            "transaction_id" => $payment_id,
                            "value" => $value,
                            "currency" => $currency,
                        ]).');
    

    And here’s the gtag that I’m referring to:

    <!-- Google tag (gtag.js) -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXX"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'G-XXXXXXXXX');
    </script>
    

    I’m scratching my head here because when I echo the values, they’re all there, but they’re just not tracking for some reason. Any suggestions?

    Lucas replied 1 year, 4 months ago 3 Members · 2 Replies
  • 2 Replies
  • Aiden

    Member
    27 March 2023 at 6:23 pm

    The problem you are experiencing might be due to an incorrect or delayed syncing between your website and Google Analytics 4 (GA4). The code you have shared seems to be correctly configured for tracking events like “purchase”, including transaction_id, value, and currency. However, tracking might not be immediate. It can occasionally take from a few minutes to 24 hours for Google Analytics to start showing data from tracking codes. If you have just implemented the tags, give it some more time. Additionally, ensure that there’s no ad blocker or browser setting that might be preventing Google Analytics from tracking. You may also want to use Google’s Tag Assistant: a tool to verify if your tags are firing correctly.

  • Lucas

    Member
    22 May 2023 at 12:52 pm

    There can be several reasons why the data isn’t showing up as expected in Google Analytics 4. First, ensure there’s no issue with the formatting or typing of the purchase event that you are trying to track. Remember to use correct field names as per the GA4 documentation since they are case sensitive.

    Additionally, verify that the gtag id in your analytics snippet matches the one in your GA4 property. If there is a discrepancy, it could lead to the data being sent to the wrong property.

    Another possibility is a delay in data appearing in the reports, which can take up to 24-48 hours.

    If everything seems correct, have a look at your website with the ‘Google Tag Assistant’ extension, which helps debug your tags. Alternatively, you can also use the ‘Realtime’ report in GA4 to test if your events are being sent correctly.

    Lastly, check to see if any sort of ad-blocker or browser settings are preventing the gtag script from running correctly, as these could interfere with your tracking.

Log in to reply.