To install our 1st party tracking you need to implement our redirect script first. You can find the information on how to set it up here:

Installing-1st-party-tracking

If you want to implement the redirect script via Google Tag Manager, please follow the instructions here:

Installing-1st-party-tracking-with-google-tag-manager

Implementing the script

The conversion script has to be implemented in the WooCommerce administration backend.

You need to add this code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update the theme.

You can find the conversion script here:

// Add TC tracking code to the thank-you page
add_action( 'woocommerce_thankyou', 'targetcircle' );

function targetcircle( $order_id ) {

// Manual configuration
$data = array(
'offer_sid' => 'OFFER_SID',
'event_sid' => 'EVENT_SID'
);

// Get order data
$order = wc_get_order( $order_id );
$data['id'] = htmlentities( $order_id, ENT_QUOTES );
$data['amount'] = htmlentities( (float) $order->get_subtotal() );
$data['currency'] = $order->get_currency();

// Print script tag
echo "<script src=\"https://cdn.trackmytarget.com/tracking/s/checkout.min.js\" data-type=\"sale\" data-offer-sid=\"{$data['offer_sid']}\" data-event-sid=\"{$data['event_sid']}\" data-id=\"{$data['id']}\" data-amount=\"{$data['amount']}\" data-currency=\"{$data['currency']}\"></script>";

// Print noscript tag
echo "<noscript><img src=\"https://p.trackmytarget.com/?type=sale&offer_sid={$data['offer_sid']}&event_sid={$data['event_sid']}&id={$data['id']}&amount={$data['amount']}&currency={$data['currency']}\" alt=\"\" width=\"1\" height=\"1\" border=\"0\" /></noscript>";}

Parameters

  • OFFER_SID required
    Replace with 6 character sID of the Offer. You can find this value in the Offer list of the marketplace or ask your account manager.
  • EVENT_SID required
    Replace with the 6 character sID of the product group. You can find this value in the tracking tab when creating or editing an Offer or you can ask your account manager.

Did this answer your question?