To monitor your WooCommerce sales on Tracknow, an integration is required.
By embedding the pixel image code, every completed purchase will be automatically sent with the relevant sales data to Tracknow, allowing you to track conversions directly on your dashboard.
(Recommended)
Option1: WooCommerce Plugin
Integrating Tracknow with your WooCommerce store has never been easier, simply install the Tracknow Plugin from the link below and follow the instructions in the link:
Option2: Traditional tracking pixel
Locating where the code is added on WooCommerce
- Log into your WordPress dashboard
- On the main menu, select ‘Appearance’ and on the newly opened menu select ‘Theme File Editor’
- Locate the functions.php file in the list of files associated with your active theme and click on it to edit
- The file’s code box will open – this is where you’ll add the code


Find your campaign’s Conversion Tracking URL on Tracknow
- Login as an admin to the Tracknow platform and click ‘Campaigns/Offers’ on the left menu
- Click on the name of the campaign you wish these purchases to be associated with
- On the secondary menu, select ‘Setup/Integration’ and click on ‘IMAGE’
- Copy only the part of the link that is highlighted in the screenshot below


Adding the code
Whenever a purchase is made we would like to send the following details:
- Send the WooCommerce order ID
- Send the order’s amount
- Associate the purchase with campaign ID = 1 (the campaign ID may be different in your case, depending on which campaign on Tracknow you’d like the conversions to be added under)
We’ve prepared a simple template for you to use:
function tracknow_tracking( $order_id ) {
// Ensure the order exists
$order = wc_get_order( $order_id );
if ( ! $order ) {
return;
}
// Retrieve the `click_id` from cookies if it exists
$click_id = isset($_COOKIE['click_id']) ? $_COOKIE['click_id'] : null;
// Get order details
$order_total = $order->get_total();
$order_shipping = $order->get_shipping_total();
$coupons = $order->get_used_coupons();
$coupon_code = ! empty( $coupons ) ? $coupons[0] : '';
// Common query parameters
$query_args = [
'order_id' => $order_id,
'amount' => $order_total - $order_shipping,
'coupon' => $coupon_code,
'goal' => '',
];
// Add tracking ID
if ( $click_id ) {
$query_args['click_id'] = $click_id;
} else {
$query_args['campaign_id'] = 1; // Replace with actual campaign ID if needed
}
// Determine if we're on the thank you page
if ( is_wc_endpoint_url( 'order-received' ) ) {
// Use success.jpg (pixel tracking)
$tracking_url = add_query_arg( $query_args, 'https://example.tracknow.info/success.jpg' );
echo '<img src="' . esc_url( $tracking_url ) . '" width="1" height="1" style="display:none;" alt="" />';
} else {
// Use postback endpoint (server-side GET)
$postback_url = add_query_arg( $query_args, 'https://example.tracknow.info/postback' );
wp_remote_get( $postback_url );
}
}
// Hook into WooCommerce order completion to trigger the tracking
add_action( 'woocommerce_thankyou', 'tracknow_tracking', 40 );
add_action( 'woocommerce_order_status_processing', 'tracknow_tracking', 45 );
add_action( 'woocommerce_pre_payment_complete', 'tracknow_tracking', 50 );
add_action( 'woocommerce_payment_complete', 'tracknow_tracking', 55 );
Copy and paste the code into the code box section in the functions.php and click ‘Update File’