Product Specific Conversion Code
-
Hi,
I read this article https://woorkup.com/setup-conversion-tracking-woocommerce/#comment-2483375751 about Product Specific Conversion Code.
1. Do I need to add this code to the function.php file even when using your plugin?
2. If I do need to add the code to the function.php then what do I add in this section?
// INSERT TRACKING CODE or
// DO YOUR CUSTOM BEHAVIOR HEREIs it the whole google conversion script or just the code? can you pls give an example?
I asked this because when I add that code to function.php and that section I added the whole script from google conversion code. It crashed my site. I had to delete those code.Thanks.
get_items() as $item ) {
$product = $order->get_product_from_item( $item );
if ( ! $product ) { continue; }
$sku = $product->get_sku();
if (preg_match(‘/-tp$/’, $sku) === 1) {
return true;
}
}
return false;
}function my_custom_tracking( $order_id ) {
$order = new WC_Order( $order_id );if (order_items_include_tracking_pixel($order, $order_id)) {
$total = $order->get_order_total();// INSERT TRACKING CODE or
// DO YOUR CUSTOM BEHAVIOR HERE
}
}add_action( ‘woocommerce_thankyou’, ‘my_custom_tracking’ );
?>
https://www.ads-software.com/plugins/woocommerce-conversion-tracking/
- The topic ‘Product Specific Conversion Code’ is closed to new replies.