Tracking Woocommerce External Products
Driving myself insane trying to figure this out...
I'm using Woocommerce and trying to track GA events on the Add To Cart button for External/Affiliate Products. I've tried modifying loop/add-to-cart.php and external.php, but still cannot register any events in GA.
As of now, I've modified external.php to include:
onClick="ga('send', 'event', 'Buy Now', 'Clicked', 'Isagenix');"
So, it looks like this:
<p class="cart"> <a href="<?php echo esc_url( $product_url ); ?>" onClick="ga('send', 'event', 'Buy Now', 'Clicked', 'Isagenix');" target="_blank" rel="nofollow" class="single_add_to_cart_button button alt"><?php echo esc_html( $button_text ); ?></a> </p>
Any ideas? Thanks!
Re: Tracking Woocommerce External Products
You can easily debug on the website with GA debugger:
You can check in chrome, console tab with 'Preserve log' turned ON.
'Star' or 'Accept as Solution' if it helped.