-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EVENT PURCHASE DON'T FIRE ON LINK ORDER PAY WOOCOMMERCE #328
Comments
Hi, The purchase event will be fired when the payment is done and the order received page is shown with the thank you message. |
Hi @duracelltomi, yes, in fact, this is why I linked you to the page first, and as per proof that you can do it too and as per the screen and video recording, after I have made the purchase the purchase event does not trigger https://www.loom.com/share/efc29a3a84c04953952094f9b94436b4?sid=357f1ea1-db31-49c1-89cb-01cac08d4db2 |
I will add my voice here too. The purchase tracking is not working and the Wordpress plugin page has several people in panic mode due this. |
Hi, When I place a test order on my dev site and visit the order pay page and select an option, I can see the purchase event. I have a draft solution for that, if any of you has a safe test site where one PHP file in GTM4WP can be replaced to test a possible fix, we could see if this solves your problem. Without this, you can also test if you have a similar problem if you turn on "Do not flag orders as being tracked" option in GTM4WP under Integration->WooCommerce |
I have no option to test this more but it seems that earlier versions of plugin did work and there was some breaking changes. https://wordpress.org/support/topic/gtm4wp-purchase-ebvent-is-not-working/ |
@SirRahikkala 2 of 3 topics you mention are not related, they are just lazy users who don't read update for breaking changes and don't update their GTM as instructed here: https://gtm4wp.com/announcements/be-prepared-to-big-changes-in-gtm4wp-v1-20.html |
What I am testing currently is to remove the purchase tracking when detecting the is_order_received() tag and only fire on the woocommerce_thankyou action. Hopefully it will be really only fired once when the thank you page is being generated. |
I need someone who can test a bigger change in GTM4WP on a test instance so that it does not break any live site: integration/woocommerce.php has to be replaced with this: What does this do? Since the beginning, GTM4WP fired the purchase event during page load when the WooCommerce tag For some reasons, this does not work in more and more cases. This test moves purchase tracking into another WooCommerce hook: What is moving with this change:
|
I think I have the same issue. The site I deal with has very low frequency of purchases, so I wasn't sure for a while, but now I am convinced. |
@Blueboots the same issue (missing purchase conversions) can be caused by many factors. When you started seeing this after implementing CoMo, it could mean that there is a problem with your CoMo setup. When you send the purchase event with analytics consent denied, it will be only used for modelling purposes. This could be also the case when the purchase event is fired too early, before the update consent command and executed with the default consent flags that is usually denied by default. |
Agreed it could be many things, but part of my Consent setup involved upgrading to GTM4WP v1.20.1 to fix the bug of the GTM container still appearing when off and with console error messages off. So my purchases stopping correlates with updating to v1.20 AND my consent implementation. Unfortunately I cannot dig very deep in the actual checkout to debug, but as you mentioned that the purchase event fired during page load, and some (but not all) people have been adjusting when their GA4 tags fire relative to page load, I thought it might be useful info. |
Thanks for sharing your findings, it is indeed valuable for others. |
I spoke with the website owner and he has confirmed having the woocommerce_thankyou hook on the thankyou page. I have done some test purchases, and although all the other ecommerce events work fine, the Purchase GTM event still doesn't fire. If you can do a test yourself that would be great. The site is in Spanish. You can test purchase the following product and then choose the payment option of " transferencia bancaria" (bank transfer, so no payment card needed as you won't be doing the transfer). |
To clarify: I mean that the dataLayer event "purchase" is not produced even though the woocommerce_thankyou hook is present, so therefore my GA4 Ecommerce tag can't be triggered. |
Thanks for the clarification. Could you tell me what payment gateway you are using and whether they have some sort of sandbox environment where I could create an account install the plugin on my dev site? I did the same with Klarna earlier and was able to find solutions. |
The payment gateways listed and activated within Woocommerce are: I don't think there will be any sandbox. It's a one man operation. Any clues would be most welcome. |
Could you pick one that does not work for you for sure? |
Bacs is exactly the one I can test easily, and it doesn't work. I presume none of the others do either, as my GA4 setup has not shown any purchases at all since the issue started. |
That is interesting, thanks! |
Same here. The weird things is that in realtime view on GA4 the purchase gets captured, then a few hours later is gets removed. I have been in contact with Google support and they advised the following: “ Also ensure you take a back-up of the website before you install the codes along with this go to the plugin GTM4WP and please have the "container code" toggled off. Kindly share the screenshot of the GTM plugin in the wordpress account as the Ecommerce data was sent using the plugin. So we requested you to kindly turn off the container code in the GTM plugin and install the Google Tag Manager script directly on the website. If you have made this change today, I request you to kindly monitor the changes for the next 24-48 hours. If the issue still persists, I request you to completely disable the plugin and set up the GA4 Ecommerce tracking using our developer guide which is a standard method of implementation. Here is the link - https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtm#make_a_purchase_or_issue_a_refund You would require help from a developer and make changes to the script before installing them on the website. The document contains detailed instructions. Please follow the document and make changes accordingly. |
If the purhcase event appears in GA4 realtime but not in reports, that is an indication of a consent mode setup issue. It might happen that the analytics_storage flag is not (yet?) set to granted when the purchase event fires. I could be a race condition between the consent banner script and the purchase script. Google's support just tries to eliminate some root case, for example a badly formatted GTM container code or a completely wrong ecommerce implementation. I would say neither is true with GTM4WP at least not in general. |
Hi, |
Digging in more to try and at least find more clues to the root of my problem I see that the 'ecommerce' object is generated correctly on all pages EXCEPT the 'order-received' page. There, there is an 'orderData' object which I guess is what Woocommerce makes. I've read you before saying that non-standard thank-you pages or plugins can break GTM4WP purchase tracking. I suppose they could also break the ecommerce object creation. |
Hi everyone, feeling good as our bug was identified and fixed. Here are the details for all those interested. The crypto coin plugin 'Bit2Me' was the cause that broke GTM4WP and stopped the creation of the ecommerce object and the purchase event on the ThankYou page. The website owner tells me that the plugin initially worked when we were on GTM4WP v1.19, but then broke on upgrading to v1.20 or v1.20.1 (That tracks with my memory of the course of events, but I was pretty confused at the time by implementing Consent Mode, which is what necessitated the upgrade to v1.20 in the first place. Phew!) I can't give you any more technical details of why the Bit2Me plugin interfered with GTM4WP, sorry. |
Hi @duracelltomi, I'm opening this issue to you because I noticed that when I send the link for the order balance like this link:
https://diventapilota.wecanrace.it/checkout/order-pay/154144/?pay_for_order=true&key=wc_order_wAIvqvnxiO0oH
the purchase event is not triggered and I lose tracking of these orders that are tracked.
The text was updated successfully, but these errors were encountered: