How do I stop Square Online pushing the view_item event twice?
This is driving me crazy. I have removed the google GA4 tracking code from the settings for my square website and have replaced it with custom code for the google tag manager (GTM).
It looks like there is some vestigial code still in my header that is causing the view_item event to fire twice when a product page loads.
<script data-cookieconsent="ignore">
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
</script>
How do I get rid of this?
I know that the method to insert tracking code has changed since I first started with Square online, and I have a feeling that there are multiple instances of my old GA4 tracking code firing but I can't see it explicitly anywhere when I look in the page source. this "gtag" is the closest I could see.
Square support is absolutely not helpful in the slightest for this issue (or anything, really) so I'm praying that someone can help me here.
It 100% is not an issue with google. It is something with how the page is loading and somehow deciding to double-send tracking data.
Thanks!
Hey there, @abfabhb -
Appreciate you reaching out about the coding issue you're seeing. I am going to suggest taking this over to our develop pages. They will have more support for your issue.
The Square Community is the home for Sellers to help other Sellers grow their business and answer their questions about Square. Since you're looking for a developer, my best advice here is posting this on our Developer Forums. Once there, you can head over to the Support Tab on the top and choose Developer Forums or Discord Community. I am sure you will find answers and hopefully a Developer to work with.
Thank you!
Square Community
Square Products