E-commerce data?
-
Hi,
On a WooCommerce site, I activated the options Enhanced measurement and Plugin conversion tracking in Site Kit but events like
add_to_cartorpurchasedo not appear in the Google Analytics data. The option Exclude Analytics is limited to Users that can write posts.The site uses and a Twenty Twenty-Five theme with modified templates. Notably: the Single Product template uses the new Add to Cart + Options (beta) block.
Gemini told me that it should work, but apparently not… Is something going wrong on the site or is Gemini wrong (again)?
Thanks for any thoughts 🙂
The page I need help with: [log in to see the link]
-
Forgot to mention: this site https://yvanoe.fr uses Google for WooCommerce too, which needed an extra code snippet added with WPCode to make
page_viewavailable to Site Kit. This code was provided by Gemini and has resolved the incompatibility between Google for WooCommerce and Google Site Kit:/**
* Zorg dat Google for WooCommerce page_views ook naar GA4 verzendt.
*/
add_action( 'wp_footer', function() {
?>
<script id="gla-ga4-fix">
(function() {
if (typeof window.gtag === 'function') {
// Stuur een expliciete page_view naar je GA4 ID zodra de pagina laadt
window.gtag('event', 'page_view', {
send_to: 'G-24K52RH9T8'
});
}
})();
</script>
<?php
}, 99 );But Gemini informs me that Google for WooCommerce cannot be responsible for capturing/blocking
add_to_cartandpurchaseevents.Moreover, another site https://valvichavre.fr, with similar setup but without Google for WooCommerce (pointless because CBD products are deemed illegal by G) the same issue is happening: no
add_to_cartandpurchaseevents in Google Analytics :/Hello @ravanh, thanks for getting in touch. We’ve seen similar issues to this recently so I’d be happy to help you with your individual case. To start, please could you share the following:
- Your Site Health information. You can use this form to share privately if preferred.
- Where are you checking this? Are you checking for these events in your Analytics realtime reports? Feel free to share a screenshot or recording to the private form above.
- Have you tried a test purchase after temporarily disabling all plugins except for Site Kit and the appropriate WooCommerce plugins? You can also try switching to a default WordPress theme temporarily for this test.
Checking your site using https://tagassistant.google.com/ I can see that these events are firing so something is blocking them from displaying in your Analytics reports. You can also review this topic we recently had which may provide you with some helpful checks to perform.
Hi @adamdunnage thanks for responding so quicly 🙂
When I look in tagassistant, I see all events (including add to cart and basic page/item view) are going to the AW-16927111091 container and not to G-24K52RH9T8. The first container is the one linked to Google Ads and Merchant Center as configured in Google for WooCommerce, while the second container is the Analytics stream.
Should the conclusion be that Google for WooCommerce and Google Site Kit really do not work well together? Is there any way to get e-commerce events to reach the analytics stream?
@ravanh No problem. Are you using Google for WooCommerce on this site currently? If you could share the requested information above then this will help me to look at your site setup in more detail to see if I can see what might be the cause of this.
But yes you are right, all events (including add to cart and basic page/item view) are going to the AW-16927111091 container and not to G-24K52RH9T8. Please share the information requested above and I can investigate further.
Okay, I did the same test in tagmanager but this time with the Google for WooCommerce plugin disabled. Now all events indeed reach the G-24K52RH9T8 container (the other container is no longer detected) but there are no ecommerce events like Item View or Add to Cart anymore…
I’ll send the requested data via the form.
@ravanh Thank you for sharing the information. While running some further checks I think I can see what the issue is. When visiting your site, I don’t see a consent banner on your site for users to grant consent. Without this, Analytics data for users in the European Economic Area (EEA), Switzerland and the United Kingdom will not be tracked unless they have granted consent. You can find out more about this in our consent mode guide.
I would suggest reading through this guide paying particular attention to the consent management plugin section making sure to implement this on your site. Once done, try adding a product to cart once more and confirm if you encounter the same or if you can now see the add_to_cart event in your Analytics.
Let me know how you get on with this.
Hi Adam, in fact I actively disabled the consent mode and banner because of the issues. So when normal events like page_view kept working, I assumed the issue would come from elsewhere…
But as I understand it now, when Analytics and Ads are set up together, but without consent mode, some events are not properly reaching Analytics. Is that correct? I’ll have to set it up again, this time paying close attention to the consent banner configuration…
On the other site, https://valvichanvre.fr/, the cookie banner consent is still active. The banner is managed by SEOPress and seems to handle the Sitekit Analytics script payload just fine. But maybe it’s not 100% compatible with the Ads/E-commerce part?
On https://yvanoe.fr I have activated Complianz and temporarily deactivated Google for Woocommerce to rule out any conflicts, leaving only Site Kit with advanced plugin conversion tracking and consent mode ON.
Still no
add_to_cartevents… I seepage_view,user_engagement,form_startandform_submitarriving in the tag assistant. The last two seem to correspond with adding a product to cart. Will this be enough to fill purchase funnel data in the Google Analytics e-commerce reports?Hi @ravanh, thanks for the extra details. One thing stands out: your Single Product template uses the Add to Cart + Options (beta) block. Could you temporarily switch one product (or a staging copy) back to the default Single Product template and test adding to cart again, logged out or in a private window? If
add_to_cartappears in Tag Assistant then, that tells us the beta block isn’t being picked up yet.For yvanoe.fr, I’d recommend choosing one plugin to handle the GA4 ecommerce events rather than both. Once that’s settled, remove the WPCode
page_viewsnippet so page views aren’t counted twice. For the second site, could you check in Tag Assistant whether the events fire after accepting the SEOPress cookie banner?Let me know what you find and we can go from there.
Hi @adamdunnage thanks for the feedback. I’ll try to find out more and report back here 🙂
About the site with the SEOPress banner: yes after accepting, regular events fire, but no
add_to_cartor other e-commerce events as far as I can tell.In the meantime, working on a third e-commerce site, this time with EDD (not WooCommerce) I ran into the exact same issue. But after switching the Add to cart button behavior,
add_to_cartevents started flowing: The behavior was initially set to redirect to the cart/checkout page immediately, but switching the behavior to add to cart but stay on the product page (AJAX) seemed to have solved the issue. I’ll try similar changes on the two WooCommerce sites…Update: In can confirm, it is indeed the new “Add to cart + options (beta)” version of the add to cart block that is not properly recognized by Site Kit. Reverting to the old “Add to cart with Options” version,
add_to_cartevents start flowing again 🙂@ravanh Glad to hear that we’ve found the cause. Thanks for confirming this. I will raise this with the team to see if there’s anything we can do on our side to improve on this from a Site Kit perspective.
Is there anything else I can help you with?
Great! Marking this a solved. Thank you @adamdunnage 🙂
You must be logged in to reply to this topic.