I've added a custom tracking code to the order status page that logs each transaction on that page.
It is working as expected, except that in addition to logging the transaction properly, it logs a few (2-4 usually) other transactions at the same time, with seemingly random revenues and instead of a shopify ID #1234, it has an ID like 53212987 or some random string of numbers.
There is no issue with the tracking code. It's fairly simple and I've used the same code on an other shopify site with no issues.
Could it be that users are reloading the order status page and then it loses the real cart data on reload? So it logs a fake transaction? Or is there anything else anyone can think of that could be causing this result?
Another thought I had is that, while we have built a custom store for the client using the Buy Button, they seem to have also implemented the Online Store. Could this be causing issues with data overlap? Does the order status page custom code run in the Online Store as well as the Buy Button?
Any ideas are much appreciated.
You can use the if first accessed liquid code on the order status page to run a bit of code once for a new order: https://help.shopify.com/manual/orders/status-tracking/first-time-accessed
I suggest doing that and see how it goes.
I've seen a bunch of stores with unusual transaction ids in the sales performance report of analytics. I doubt it is draft orders because but they do not push into analytics.
It didn't seem to have an effect actually. We are still getting 2-3 extra logged transactions for every 1 real one.
I did a test where I went through the checkout process, stopping each time after completing one more step than the last, then clearing my cookies/history and doing it again (i.e. first time i stopped after adding an item to my cart, second i stopped after entering my address in checkout, third time i stopped after entering payment info in checkout).
At least one of the logged trancsaction was clearly the pre-tax amount of the final transaction, which shouldn't be getting logged (I guess this happens on the final step before completing checkout).
But this test showed us that our GA code is getting run on more than just the 'thank you' page. Could this have to do with the shopify cart being iframed into our site? The iframe reloads as if new on every new step and thus runs the GA code on every step?
I also tried inserting some code into the additional scripts that would ping a dummy site I set up with some basic info to try and understand what's going on, but it didn't work, I'm guessing for security reasons we're not allowed to make cross-domain requests from the additional scripts section?
We have found a way in GA to filter out all of the 'fake' data, since all of the legitimate transactions have shopify IDs of the format "#4XXX" or "#5XXX", but since our client will be learning and using the GA console, we would still like to find a way to remove the 'fake' transactions so as to avoid confusion.
You say the transaction data was triggered on more then the thank you page. What pages? Do you mean on the payment information page?
This issue seems related: https://ecommerce.shopify.com/c/ecommerce-marketing/t/shopify-logging-ga-data-multiple-times-for-one...
Another idea. You could try collaborate with Bergan to isolate the issue or look for similarities between your's and his store.
That other question is actually me, just logged in as a different user. In my comment just above yours, I describe the process of testing I did and the results I saw, which led me to believe that the code is running on more than just the last page of checkout.
I have achieved exactly what I am trying to do on a different Shopfiy site, rovrproducts.com. The same steps I took to make it work on that site have not worked properly on this one.
The main differences are: this site has the shopify component iFramed in, whereas the rovr site interacts via the API and only goes to a shopify-controlled page for the actual checkout process. This site also has a wordpress frontend (I can't imagine this matters though), whereas the rovr site was a custom frontend.
Is there anyone I can talk to who has access to actual metrics or code, who can look into exactly what is happening here at the root of the issue? Shopify's relatively closed environment doesn't allow me to do any real debugging, so I need someone on the shopify side who has technical knoweldge to take a look.