Learn business growth with Google Analytics 4 Forums Google Analytics 4 Troubleshooting: Issues with Google Analytics Monetization Tracking

  • Troubleshooting: Issues with Google Analytics Monetization Tracking

    Posted by Liam on 13 January 2023 at 8:06 am

    Alright, so here’s the deal. I’ve got GA4 set up on my site, but something’s not right and I need a hand figuring it out. My Monetization tab is coming up all zeroes and the conversions… phew! They’re missing. I’ve got a funny feeling it may be due to some funky coding – who knows, right? I’ve been googling like crazy but can’t find a solid answer anywhere on how to set it all up properly.

    Here’s how I’ve done it so far:

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <!-- Google tag (gtag.js) -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=<?= 'G-TESTSTRING' ?>"></script>
    <script>
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());
    
        gtag('config', '<?= 'G-TESTSTRING' ?>');
    </script>
    
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Title of the page</title>
    </head>
    <body>
    <p>Welcome to my website!</p>
    <script>
    gtag('event', 'purchase', {
        'value': 19.00,
        'currency': 'USD',
        'transaction_id': '6421594615a7b',
        'event_action': 'test_transaction',
        'event_category': 'conversion',
        'items': [
            {
                'id': 'SKUID',
                'name': 'Name',
                'price': 19.00,
                'quantity': 1
            }
        ]
    });
    </script>
     </body>
    </html>
    

    Is there something I’ve goofed up here? Can you spot any issues?

    Lily replied 1 year, 4 months ago 3 Members · 2 Replies
  • 2 Replies
  • Ethan

    Member
    15 April 2023 at 7:21 am

    The issue appears to be with how you are passing in event parameters in your ‘purchase’ event. In GA4, the correct parameters for the ‘purchase’ event aren’t ‘event_action’ and ‘event_category’, but ‘transaction_id’, ‘affiliation’, ‘value’, ‘tax’, ‘shipping’, ‘items’, and ‘coupon’. Additionally, the item array arguments should contain ‘item_id’, ‘item_name’, ‘affiliation’, ‘item_brand’, ‘item_category’, ‘item_variant’, ‘item_list_name’, ‘item_list_id’, ‘index’, ‘quantity’, ‘price’, ‘item_coupon_code’, ‘discount’, ‘currency’. Please refer to the GA4 documentation for specifics on sending purchase events. So, you should revise your gtag script accordingly, replace the placeholders with actual values and map your product data properly into the ‘items’ array.

  • Lily

    Member
    3 May 2023 at 5:48 am

    Based on your code, it seems like you’ve done most of the initial configuration correctly. However, there’s an important detail about GA4 that might be causing your issue: unlike the previous versions of Google Analytics, GA4 handles e-commerce data in a slightly different way. In GA4, the ‘purchase’ action (which tracks conversions) requires a specific data structure called the ‘item’ array which you have used correctly. However, please make sure to replace ‘SKUID’, ‘Name’, and ‘19.00’ with actual values and ensure that ‘G-TESTSTRING’ is replaced with your actual Google Analytics Measurement ID.

    Besides, GA4 also uses some new specific names for the event parameters. Here you should replace ‘event_action’ and ‘event_category’ with ‘transaction_id’ and ‘affiliation’. If such changes don’t take effect, the problem could be due to other factors such as the Google Tag patch not being implemented properly or tracking being blocked by browser privacy settings. It’s also possible that there might be some delay for the data to come up on the Google Analytics dashboard. Therefore, it’s best to try all these troubleshooting steps before concluding the root of the problem.

Log in to reply.