If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

How do I add affiliate tracking pixels to my site?

Situation:

You've just signed up with an affiliate system who's promised you the ultimate in statistics tracking, commission handling, referral monitoring, and more.
They've given you a snippet of code and instructed you to place it on your site, after replacing some parameters with actual values of orders in your store. But ... you don't know where to put it.

Solution:

1. First, you need to make sure you have an appropriate override file in place.

THERE ARE TWO OPTIONS:
a) javascript file (recommended)
To do it with a javascript file, simply create the following file:
/includes/modules/pages/checkout_success/jscript_myaffiliate_program.php

b) template file:
To do it with a template file, you'll need the following file on your server: /includes/templates/YOUR_CUSTOM_TEMPLATE_NAME/checkout_success/tpl_footer.php (replacing YOUR_CUSTOM_TEMPLATE_NAME with the name of your actual custom template, of course)
If you don't already have that checkout_success folder at that location, create it. And then copy the tpl_footer.php file from your /includes/templates/YOUR_CUSTOM_TEMPLATE_NAME/common/tpl_footer.php ... or if you don't have one there, get it from template_default.

2. Using your favorite reliable text editor (such as Sublime Text or Notepad++), edit the file, and paste the code snippet from your beloved affiliate company at the bottom of the file.
Save the file, but leave it open in your editor.

3. Now, for each parameter that your affiliate company told you needs to be replaced dynamically, substitute the appropriate value from the table below:

Value to replace

What to replace it with

Order Number

<?php echo $order_summary['order_number']; ?>

Subtotal

<?php echo $order_summary['order_subtotal']; ?>

Amount of credits/discounts on the order

<?php echo $order_summary['credits_applied']; ?>

Final Total

<?php echo $order_summary['order_total']; ?>

Commissionable Order Amount (does not include discounts)

<?php echo $order_summary['commissionable_order']; ?>

Commissionable amount, formatted with dollar sign and decimal point (per currently selected currency formatting rules set in your admin)

<?php echo $order_summary['commissionable_order_formatted']; ?>

Coupon Code, if any (often used for referral tracking)

<?php echo $order_summary['coupon_code']; ?>

Currency Code (3-letter ISO code)

<?php echo $order_summary['currency_code']; ?>

Exchange Rate applied, if any

<?php echo $order_summary['currency_value']; ?>

Payment Module used

<?php echo $order_summary['payment_module_code']; ?>

Shipping Method selected by customer

<?php echo $order_summary['shipping_method']; ?>

Order Status (number) denoting the order's status in your store at this present time.

<?php echo $order_summary['orders_status']; ?>

Tax on the order

<?php echo $order_summary['tax']; ?>

Shipping Cost on the order

<?php echo $order_summary['shipping']; ?>

Order Total (the final/net total of the order, the amount sent for payment)

<?php echo $order_summary['order_total']; ?>

Product Model Numbers (delimited with "|")

<?php echo $order_summary['products_ordered_models']; ?>

Product IDs (delimited with "|")

<?php echo $order_summary['products_ordered_ids']; ?>

Save the file and upload it to your server, keeping in mind the correct folder location as explained in steps 1 and 2.

4. Test

Need to pass details of specific products ordered? See the additional variables outlined in the article linked below.