Analytics
5.6K members online now
5.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
star_border
Reply

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>
</p>

 

Any ideas? Thanks!

Re: Tracking Woocommerce External Products

A T
Participant ✭ ✭ ✭
# 2
A T
Participant ✭ ✭ ✭
Hi,

You can easily debug on the website with GA debugger:
https://chrome.google.com/webstore/detail/jnkmfdileelhofjcijamephohjechhna

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

Best Regards,
GA Guru.

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