WooCommerce Conversion Tracking Script for two Pixel

I want to promote my products by some affiliate networks.

Do only thing you have to do, is to go into the function.php file and add this script with the pixel. With this script the tracking of the amount value works fine. This script works only for one network and if you are the only vendor.

add_action( ‘woocommerce_thankyou’, ‘my_custom_tracking’ );

function my_custom_tracking( $order_id ) {

$order = new WC_Order( $order_id );

$total = $order->get_subtotal();

$id = str_replace(‘#’, ”, $order->get_order_number());

echo ”;

My problem: I have multiple Vendors who are using my plattform for Product delivery / purchase processing.

I need to know how i can modify the function file in order to add a working second script for a 2nd pixel if a specific product has been selected and bought.

My it skills in woocommerce are limited, so i would like to understand how to modify the script without harming the (general) tracking.

  1. If somebody buys the “normal” Products than the 1st pixel above should fire.
  2. If somebody buys a specific product with the Product_Nr. 2004 – than a 2nd different pixels needs to fire and ignore the first pixel.

Do i need to add a second function or modify the first one?

Thank you

Read more here: WooCommerce Conversion Tracking Script for two Pixel

Leave a Reply

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