Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Torben Lundsgaard

    (@torbenlundsgaard)

    Please go to ‘GTM Kit > Help > Support > Share system data with the GTM Kit support team’ and enter the support ticket: FS803-B2364

    Thread Starter nrsoft

    (@nrsoft)

    Done, thanks for your help in advance

    Plugin Author Torben Lundsgaard

    (@torbenlundsgaard)

    Please go to GTM Kit > General > Misc > Logging and debugging > Debug log. Activate debug log and make a purchase. Then go to WooCommerce > Status > Logs > Browse log files. There should be a log with the name ‘gtmkit-purchase’.

    Plugin Author Torben Lundsgaard

    (@torbenlundsgaard)

    Also when you make the purchase you should have your browser inspector open and look for console errors.

    Thread Starter nrsoft

    (@nrsoft)

    Hello

    Here is the log for 2 orders received this morning (website is in production so I can’t make an order myself)

    Looks like the purchase event is triggered?? Still nothing on GA4 though ??

    2024-05-24T06:37:58+00:00 INFO Array
    (
        [pageType] => order-received
        [event] => purchase
        [ecommerce] => Array
            (
                [transaction_id] => 1839
                [value] => 68.6
                [tax] => 6.24
                [shipping] => 0
                [currency] => EUR
                [coupon] => maman15|mum15
                [items] => Array
                    (
                        [0] => Array
                            (
                                [id] => 670
                                [item_id] => 670
                                [item_name] => Ile Saint Louis
                                [currency] => EUR
                                [price] => 34.3
                                [item_category] => Occasions spéciales
                                [item_category2] => Shabbat
                                [quantity] => 2
                                [coupon] => maman15|mum15
                                [discount] => 14.7
                            )
    
                    )
    
            )
    
        [new_customer] => 1
    )
    2024-05-24T06:40:45+00:00 INFO Array
    (
        [pageType] => order-received
        [event] => purchase
        [ecommerce] => Array
            (
                [transaction_id] => 1840
                [value] => 49.37
                [tax] => 5.08
                [shipping] => 6.43
                [currency] => EUR
                [coupon] => maman15
                [items] => Array
                    (
                        [0] => Array
                            (
                                [id] => 731
                                [item_id] => 731
                                [item_name] => Charonne
                                [currency] => EUR
                                [price] => 41.65
                                [item_category] => Occasions spéciales
                                [item_category2] => Naissance
                                [quantity] => 1
                                [coupon] => maman15
                                [discount] => 7.34
                            )
    
                    )
    
            )
    
        [new_customer] => 1
    )
    

    Let me know if you need something else.

    Thanks

    Plugin Author Torben Lundsgaard

    (@torbenlundsgaard)

    That confirms that the datalayer data is being generated on the order-received page ‘/commander/commande-recue/’. You can deactivate the debug log again.

    The next step is to find out why it is not being pushed to the datalyer in the GTM container. There can be many reasons why it is not being pushed: pagespeed plugin, payment gateway is redirecting the user, customized order-received page etc.

    You need to make a purchase a with the browser inspector open so you can:

    • See if there are any JavaScript errors on the order-received page
    • Inspect the html and search for ‘gtmkit-datalayer-js-before’ and check if the purchase event is present.
    • Check if the user is redirectet from ‘/commander/commande-recue/’ before the ‘purchase’ event is being pushed.

    If you are not able to make a purchase you won’t be able to fix the problem.

    Thread Starter nrsoft

    (@nrsoft)

    Hello

    Thanks for the detailed answer.

    I have placed an order yesterday and still had the page opened on my browser actually.

    The purchase event is not present on the confirmation page.

    <script type="text/javascript" id="gtmkit-datalayer-js-before" data-cfasync="false" data-nowprocket="" data-cookieconsent="ignore">
    /* <![CDATA[ */
    const gtmkit_dataLayer_content = {"pageType":"page"};
    dataLayer.push( gtmkit_dataLayer_content );
    /* ]]> */
    </script>

    I don’t have any specific optimization on JS in WPRocket yet but since you said it could be linked to caching I have disabled the cache on the page /commander/commande-recue/(.*)

    I have a Sentry probe for all JS errors and there is nothing coming up on this page by the way.

    Thanks again

    Plugin Author Torben Lundsgaard

    (@torbenlundsgaard)

    Since the datalayer is printed in the HTML and we have confirmed that the purchase event data is generated you most likely have a redirect problem. The purchase event is only included in the datalayer once. If the order-received page is refreshed or redirected in any way the purchase event wont be included in the next page view.

    Please download and install this fix release and activate the debug log agian: https://downloads.gtmkit.dev/fix/gtm-kit.zip

    With the fix release installed you can also add the following in your wp-config.php

    define( 'GTMKIT_ON', true );
    define( 'GTMKIT_WC_DEBUG_TRACK_PURCHASE', true );

    This vill force the purchase event to fire event hough the order is already tracked. Double conversions is not a problem with GA4, but it may be with services, so make sure you remove these constants when your are done testing.

    Thread Starter nrsoft

    (@nrsoft)

    Hello

    Thanks for your great support!

    I have installed the new version and the purchase event is now fired up! ( saw it in Real time so will confirm once it is in the real conversions tomorrow)

    Can I remove the two constants then?

    Also any idea about my second issue and the value (revenue) which is still at 0€?

    Thanks again
    Nicolas

    Plugin Author Torben Lundsgaard

    (@torbenlundsgaard)

    Since the purchase event is now firing, we know that it is in fact a redirect problem in your order-receiveed page.

    I reccomend that you remove the two constants an try to fix the redirect problem. If it is not possible to remove the redirect you can leave the constants. I means that you may have multiple purchase events on the same order so it is not an ideal solution but that is up to you.

    Regarding you second problem ‘revenue’ is only registered on the purchase event and not add_to_cart. There is a delay in GA4 so it may take a day or two before revenue is shown in the reports.

    Plugin Author Torben Lundsgaard

    (@torbenlundsgaard)

    @nrsoft Do jo need any more help or can I close this?

    Thread Starter nrsoft

    (@nrsoft)

    @torbenlundsgaard no that’s fine you can close this one. Thanks again for your support.

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.