I need to add the google analytics ecommerce tracking to a wordpress site with woocommerce.
I understand I need to add the code for tracking and on this page https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce it says I need to add some codes to a thank you page.
I’ve tried adding these codes via a
add_action( 'woocommerce_thankyou', 'my_custom_tracking' );
but in most cases I get some php error or it doesn’t work.
Also, I’ve tried google ecommerce integration plugin but it didn’t work.
What part of the GA ecommerce tracking code do I need to add and where to be able to track conversions on google analytics ?
First You need to add analytics tracking code in the footer. You can do that like this:
Then you need to add conversion tracking code, You can do that by editing your theme’s thankyou.php page