AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

2.6K members online now
2.6K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
Guide Me

Tracking Woocommerce External Products

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

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>


Any ideas? Thanks!

Re: Tracking Woocommerce External Products

Participant ✭ ✭ ✭
# 2
Participant ✭ ✭ ✭

You can easily debug on the website with GA debugger:

You can check in chrome, console tab with 'Preserve log' turned ON.

Best Regards,
GA Guru.

'Star' or 'Accept as Solution' if it helped.