Add analytics tracking to the WooCommerce thank-you page

A computer showing a graph of site visitors

8 thoughts on “Add analytics tracking to the WooCommerce thank-you page

  1. Does that sound right? The customer must view the final Order Received page for it to be tracked in Analytics?

    1. Yes, the page will need to be viewed / loaded. But customers are automatically directed there after checkout is complete.

  2. Any chance you could shed some light on how to add a little more text to that page, instead of or in addition to the boilerplate “Your order has been received.” Would love to add a few more words and maybe a coupon code for a future visit, etc. Thanks!

    1. You can either override the “checkout/thankyou.php” template and change / add text. Or you can use the woocommerce_thankyou_order_received_text filter: https://github.com/woocommerce/woocommerce/blob/2.4.7/templates/checkout/thankyou.php#L36

  3. […] Must Read Article: Add analytics tracking to the WooCommerce thank-you page […]

  4. That’s super nice and helpful but we came across a problem with Paypal tracking.

    Sometimes a purchase is tracked and sometimes it’s not. We assume that after Paypal payment you can go back to the shop but you don’t HAVE to. So some people just leave after payment without even seeing the Thank you-page.

    There is this hook we would like to try out: “woocommerce_payment_complete”. Not sure if it works though

  5. Hi! Is this applicable using other tracking pixels too? I use markethero , and I want to put pixels on my thank you page.

    1. Yes, the same method can be applied to any sort of tracking scripts. Just need to make sure you are passing in the correct variables.

Leave a Reply

Your email address will not be published. Required fields are marked *

Please note that I cannot help with customization requests. Your comment will not be approved if asking for code help. Visit this page if you need assistance with code.