yireo-magento1 / Yireo_GoogleTagManager

Implement Google Tag Manager in Magento 1 (deprecated)
Open Software License 3.0
56 stars 47 forks source link

Payments done via Mollie double the quantity of products in transactions in google analytics #99

Closed uni-t closed 5 years ago

uni-t commented 5 years ago

Hi Jisse

Previous thursday I've installed this module on an existing production shop and we did some testing with a different firm that mainly manages the google tag manager and analytics tools. Apparently when we're using the payment method Bancontact via Mollie we see in google analytics that the quantity of the transaction is double. If we use VISA from mollie or a default payment method from magento it's correct as it should.

I don't know if I have to make an issue here per se but I have absolutely no idea where to look for causing this problem. I've also contacted mollie about this and their developers will look into it.

Their module is https://github.com/mollie/Magento

jissereitsma commented 5 years ago

Thanks for reporting. Strange issue. If I would guess, I would say this might be related to the fact that the Bancontact method maybe does something strange with reloading the same twice with the same details. For instance, if the same page loads the root container twice, or something like this, it would cause duplicate code that submits the same amount of data twice.

I've scanned the code of their Magento module and can only suggest the following: In their XML layout they have a handle mpm_api_redirect of which the name seems to suggest that it is redirecting. The page template used is empty.phtml. However, this would include also GTM code, while the template is only needed for a stupid redirect. Maybe this is the issue.

The solution would be to remove the block googletagmanager_head from the mpm_api_redirect handle:

<?xml version="1.0" encoding="UTF-8"?>
<layout>
   <mpm_api_redirect>
     <remove name="googletagmanager_head" />
   </mpm_api_redirect>
</layout>
uni-t commented 5 years ago

Hi Jisse

Sorry for the delay, the other firm confirmed that they now get the correct quantity in google analytics. It has been tested with the mollie test mode. Thanks for your help!