PrestaShop / ganalytics

Gain clear insights into important metrics about your customers, using Google Analytics in PrestaShop 1.6.
11 stars 43 forks source link

Duplicate transactions #39

Open java-guy opened 9 years ago

java-guy commented 9 years ago

Hello, around 50% of the transactions in my store are sent twice to Google Analytics and screw up all my conversion measuring. The problem occurs for all payment methods.

My setup: PS 1.6.0.8, transformer 3.0.9, ganalytics 2.0.8 (module was permanently updated throughout the last weeks).

Several pages (such as this one: http://www.lunametrics.com/blog/2014/07/07/duplicate-transactions/) indicate that this is an issue which is to be fixed on the sender-side.

Any help would be appreciated. Also I can prevent all kind of additional information, if needed.

DanH42 commented 9 years ago

I'm seeing this issue as well. We're using this module on a high-traffic site, and around a thousand orders placed over the weekend weren't marked as 'seen' in the database. When everyone showed up Monday and logged into the admin, hundreds of AJAX requests started getting fired off to /admin/index.php?controller=AdminGanalyticsAjax&token=xxxxxxxxxxx&orderid=12345, all for different orders. I think the overlap of multiple admin visitors sending tracking data is what's causing us to see orders duplicated sometimes as many as 10 times in Analytics.

kermes commented 9 years ago

That is happening in fact, but I have been studying my transactions in analytics and found that some of the duplicated transactions have different referers: for example one from my backoffice issued by the employees AND one from google (supposedly, the customer when placed the order). The only way it could have happened is if the transaction was actually sent to ganalytics, but the callback that sets the row in the table to 1 didn't fire. This is the mayor source of duplicated orders in my site.

I disabled the sending of transactions from backoffice in my site until I find a solution. For statistic purposes I rather have unregistered than duplicated transactions (that's the way Analytics statistics used to work anyway)

cedricfontaine commented 9 years ago

I'm doing some investigations about this problem. I found two reasons

kermes commented 9 years ago

Hi cedricfontaine, I hope that would solve it. I also limited the javascript code in the backoffice a while ago and did reduced the amount of duplicates for the same order, but it wasn't untill I implemented a semaphore till it reduced to only 1 kind of duplicate, that is the one I described before. With the semaphore you guarantee that onle 1 transaction is sent from backoffice at a time

I'm working on a solution based on an always-send-transactions-server-side solution following this guidelines https://developers.google.com/analytics/devguides/collection/protocol/v1/reference I'm doing some tests and will release it when I have something solid

cedricfontaine commented 9 years ago

Problem to send transactions on the server side is that you cannot follow the user interaction and link transaction to the user referal information. For me, it's the more important data.

kermes commented 9 years ago

That is what I'm kind of trying to accomplish. Haven't tested yet but I hope that by sending the transaction with same client id (&cid) as the javascript script is sending, everything will be linked together (I might be wrong, but I found no evidence that this might or might not work, that is why I'm trying myself). If you know for sure this won't work, please, let me know so I can redirect my efforts to a different approach. The problem I see is that I'm using curl and I know not everybody has curl enabled in their servers, but, if this works, we can check if the curl library is installed and then use one solution or another) Thank you!

cedricfontaine commented 9 years ago

Ok, I sent a mail to Google Analytics team and hope to have more details soon.

kermes commented 9 years ago

Well, as promised: https://github.com/PrestaShop/ganalytics/pull/41 It seems that as long as the transaction is made before the google analytics cookie expires (half and hour of inactivity by default), the transaction is linked to the correct session, so all visitor data such as referal is kept. you can test it by your self. Hope we can work this through