duracelltomi / gtm4wp

Google Tag Manager plugin for WordPress
https://gtm4wp.com/
GNU General Public License v3.0
147 stars 95 forks source link

Problem with the "purchase" event #320

Open atoupet-toki opened 9 months ago

atoupet-toki commented 9 months ago

Hello! We have a problem with the "purchase" event. Wordpress and all plugins are updated. We have also tested gtm4wp version 1.20-beta.2. We also followed the tutorials to setup the plugins and the GTM (New empty container, and importing the json container from the tutorial).

We have all events in dataLayer, except "purchase". We've debugged the plugin code, and it seems that the $order->update_meta_data functions are called before the purchase_datalayer. If we comment out the 2 lines $order->update_meta_data( '_ga_tracked', 1 ); it works. But we can see that .... the 2 lines are after the purchase_datalayer.

We are using Complianz plugin for cookies. But same probleme without this plugin Has anyone submitted a similar request? Do you need more information to test and validate something? Please let me know.

Thanks in advance

Here is capture of datalayer: Capture d’écran, le 2024-01-30 à 11 34 39

duracelltomi commented 9 months ago

Hi,

In similar cases there was some sort of payment processing plugin that abnormally executed codes normally run once during generating the order received page but in the background. Therefore when the order received page was really loaded, the order was already set to be tracked once.

takibulislam commented 9 months ago

Hi, im dealing with the same issue, using default woocommerce checkout and payment processing options, but I have no clue now what exactly happening there,

is there any possible solution?

duracelltomi commented 9 months ago

@takibulislam do you have a testing/sandbox/dev version of your site where I can place an order without the need to actually pay for the products?

takibulislam commented 9 months ago

Hi @duracelltomi im not a web developer for this website, but I can get a 100% discount code with free shipping so you can avoid paying anything, do you think It will work?

takibulislam commented 9 months ago

@duracelltomi
i think the info i have provided was incorrect, here is the payment configuration of our website. image

this is the replay I'v got from the Dev team,

please let me know if you need anything else, appreciate your help

duracelltomi commented 9 months ago

Is it working if you select the direct bank transfer during checkout?

takibulislam commented 9 months ago

image I have just placed an order with Direct Bank transfer, it's not working, unfortunately.

I can provide you with a duplicate version of our website, if you want please let me know how can I send you the info

takibulislam commented 9 months ago

@duracelltomi Hello, we have created a test version of our website, if you want to test I can send you the information. please let me know,

Thank you.

duracelltomi commented 9 months ago

Please send details to messenger at gtm4wp dot com. Thanks!

takibulislam commented 9 months ago

@duracelltomi I have sent login info to the email you mentioned. I would love to know if there is any update on it.

seems like many people facing the same issue nowadays, hope it will be resolved for all of us.

Thanks for your support and waiting for your response!

duracelltomi commented 9 months ago

I received your message. I have a tough day today, it can happen that I will only be able to deep dive tomorrow

duracelltomi commented 9 months ago

OK, I was just too curious :-) When I turn on the following GTM4WP option: 'do not flag orders as being tracked' - the purchase event is there.

It means that for any reason, another plugin is calling codes normally executing while showing the user the order confirmation page. GTM4WP flags the order as being tracked once and when the real order received page is shown, no purhcase event is fired since GTM4WP "sees" that it was already tracked once.

atoupet-toki commented 9 months ago

This is exactly the same problem I mentioned, but it doesn't seem to me to be related to a payment processing plugin, we don't have the same @takibulislam and me.

takibulislam commented 9 months ago

@atoupet-toki In my case I also feel like payment processing isn't responsible, I have tried turning off that plugin but still faced the same issue. but I'm not 100% sure.

but anyway I hope Thomas will be able to figure out a decent solution for us.

duracelltomi commented 9 months ago

I just want to let you know that I am committed finding a solution to this situation but I have limited time to investigate. I do my best to find a solution as soon as possible.

atoupet-toki commented 8 months ago

hey @duracelltomi ! Have you found anything to fix the bug? @takibulislam Do you still have the problem?

duracelltomi commented 8 months ago

Hi,

No yet but I had an extremely busy week behind me, most probably I will have time to continue with the investigation next week.