Add a Facebook Tracking Pixel in WooCommerce Checkout

In this quick code snippet, we’ll demonstrate how you can add a Facebook tracking pixel in WooCommerce “Thank You” pages of your WooCommerce store, giving you new insight on how well your site converts Facebook users and a nice piece of information for your future marketing efforts.

What we’ll be doing is adding a custom function, so it would be worth taking a look into the article How to Safely Add Code to your Theme’s functions.php File. Additionally, you could use a great (free) plugin just for this sort of situation – My Custom Functions.

The Code

You will want to copy the entire code below, except for the beginning <?php on line 1.

Paste it into your custom code field, then head to your Facebook administration to grab the tracking pixel you’ve already generated. Enter it in between the notated lines.


That’s all there is to it! Now, the pixel will only fire once a user gets to the order confirmation “Thank You” page. Quick, easy, and handy – the best kind of code.

8 thoughts on “Add a Facebook Tracking Pixel in WooCommerce Checkout”

    • Hey Noah!

      You should be able to add any tracking code there that will apply to the Thank You page, so if you had a Google tracker for example then it can be added the same way. If you have multiple campaigns then that’s a little different – you’d need to set it up in your analytics tool to be more precise to see how the user came to the site with landing pages or something along those lines.

      I hope this helps/ 🙂

      Reply
    • That would be a little trickier. If you go to the Thank You template file here: you’ll see that there are conditional rules. On line 78, you can see that it uses get_payment_method. You could use that to define a PHP variable and then create if/else statements depending on what gateways you have enabled and how many different pixels you wanted to include.

      It’s likely not something I can whip up and put into a comment here, but if you’d like then reach out to me on my contact page then I’ll either be able to look into the customization or find someone who would be able to code that out for you. 🙂

      Reply
  1. I’ve been using cbd products with a view through two years now, and the knowledge has been transformative. CBD unguent has markedly improved my snooze je sais quoi and reduced my dread levels. The edibles are a advantageous and enjoyable passage to mix CBD into my common routine. I rate the natural approach to wellness that CBD offers, and I’ve knowledgeable no adverse side effects. Highly commend representing those seeking a commonplace alternative to unwritten medications.

    Reply
  2. For vibroacoustic measurements, balancing instruments are indispensable, meeting both metrological and technological requirements.

    They help reduce imbalances in rotating machinery, improving product quality and achieving significant cost savings, notably in industries with a large amount of rotary equipment.

    Although balancing equipment costs typically range from 2500 to 10000 euros with a quick payback period, it is still a major investment for smaller companies.

    Various balancing instruments are available on the market, with prices fluctuating based on their features and manufacturers.

    However, a new instrument, the “Balanset-1A,” has been developed with affordability in mind.

    By using mass-produced components, lower-cost vibration sensors, and proven management algorithms, the Balanset-1A’s price (excluding the computer) is kept under 2000 euros.

    This results in it being a much more affordable option than similar equipment on the market, providing a viable balancing solution for smaller businesses.
    You can buy a Vibrometer

    Reply

Leave a Comment