Affiliates

Tracking code

You must ensure that your URLs from the affiliate network to your website contain ?source= otherwise these will not be picked up and your tracking would not display.

Aurora has automatic de-dupe functionality built in for any affiliate, in order to ensure that only the correct affiliate gets paid.  To achieve this we set a cookie when someone comes to the website via one of the following parameters:

  • ?source=aw
  • ?source=webgains
  • ?source=linkshare

For example, https://demo.auroracommerce.com/?source=aw would set a cookie that will last for 30 days called "ac_aff_<source_type>"  with <source_type> being the name of the affiliate.  You can then access this in your templates with

{if $affiliate_visitor.aw}
My code here
{/if}

This code is stating "If they have come from Affiliate Window...".  

Testing

As Aurora automatically de-dupes, it means that once a customer has placed an order, if they were to refresh the order completion page, it would not include the tracking code again.  This is to stop you being charged twice by your affiliates.  However, in the case of testing, this can make it tiresome, which is why Aurora supports the following URL structure:

/checkout/order-complete?order_id=XXX with "XXX" being a legitimate Order # in Aurora.

Affiliate Window

Store > Settings > Feeds > Affiliates allows you to:

  • Enter an Affiliate Window ID.
  • Choose whether to send transactions on the order completion page.
  • Choose whether to log transaction tracking requests to the API Integration Log.
  • Select which type of Tracking URL to use e.g.
    • Managed Tracking URL
    • Tracking URL Template
  • For Managed Tracking URLs:
    • Choose whether to include tax in the payment amount.
    • Choose whether to include ordered item product details.
    • Choose whether to send transactions in test mode.
    • Set how Aurora should handle transaction tracking requests where the URL is larger than the maximum supported request size e.g.
      • Do not sent the request.
      • Do not send ordered item product data.
      • Truncate ordered item product data by removing the lowest value order items first.
  • .For Tracking URLs generated using a template:
    • Choose whether to remove white spaces from the tracking URL (recommended)
    • Place an order to see an example of the template generated tracking URL.

📘

If the Affiliate Window ID is present and you have ticked Send Transactions then any customer purchase will be sent server-to-server to Affiliate Window.

When using a Managed Tracking URL, requests will be sent to https://www.awin1.com/sread.php

What is sent to Affiliate Window when using a Managed Tracking URL?

The following list of parameters are sent to Affiliate Window when recording a sale during order completion:

ValueDescription
merchantThis is the Affiliate Window Merchant ID as configured in the Aurora back-end.
amountThis is the total payment made, less TAX, unless Include tax in payment amount is ticked
ttThis is a fixed value and is always set to: ss
chThis is a fixed value and is always set to: aw
crThis is the currency code in which the order has been charged e.g. GBP
refThis is the ID of the order that was placed in Aurora.
partsThis indicates whether the order was placed using an account in Aurora and what the Ex. TAX value was, e.g:

- If the order was placed by a customer with a user account in Aurora: EXISTING:
- If the order was placed by a customer without a user account in Aurora: NEW:
testmodeThis is set to 1 or 0 as configured in the Aurora back-end.
vcThis is the coupon code used on the order (if there was one)
bd[0...n]These are values that represent the ordered items.

Each ordered item will be included as a separate value e.g. bd[0], bd[1], etc

Each value is a made up of the following sub-values separated by encoded pipe character:

Fixed value: AW:P
Advertiser ID (i.e. Merchant ID)
Order ID
Variation or Product Reference
Product Name
Item Price excluding TAX
Item quantity
Empty Value
Fixed value: DEFAULT
Product Category Name

Unencoded example:
bd[0]=AW:P|1001|AA000006|B000EMSUQA|The Knife – Silent Shout|5.55|2||DEFAULT|Electronic Music&bd[1]=AW:P|1001|AA000006|B001N2Z41Y|Sigur Ros - Heima|14.99|1||DEFAULT|Music DVDsURL

Encoded example:
bd%5B0%5D=AW%3AP%7C1001%7CAA000006%7CB000EMSUQA%7CThe+Knife+%E2%80%93+Silent+Shout%7C5.55%7C2%7C%7CDEFAULT%7CElectronic+Music%26bd%5B1%5D%3DAW%3AP%7C1001%7CAA000006%7CB001N2Z41Y%7CSigur+Ros+-+Heima%7C14.99%7C1%7C%7CDEFAULT%7CMusic+DVDs

How to use a Tracking URL Template

When using a Tracking URL Template, create the following template within your front-end template directory:

checkout/awin/tracking-url.tpl.html

The following data-points are available within this template

VariableDescription
$orderDetails of the order placed.
$order.itemsPurchased items for this order.
$order.items[n].productProduct details for the purchased item.
$order.items[n].product.additional_fieldsKey/value pair of additional field values for the purchased product.
$order.items[n].product.variationVariation details for the purchased item.
$order.items[n].product.variation.additional_fieldsKey/value pair of additional field values for the purchased product variation.
$order.transactionsTransactions for the order, this will usually only contain a single payment transaction, unless you are using gift cards.
$order.transactions[n].additional_fieldsKey/value pair of additional field values for the transaction.
$order.additional.fieldsKey/value pair of additional field values for the order.

Template variable / data-point examples:

{$order.id}
{$order.user_id}
{$order.date_created}
{$order.coupon_code}
{$order.currency_code}
{$order.shipping_amount}

{math 
  assign="amount" 
  equation='x-y-z' 
  x=$order.order_total 
  y=$order.order_tax
  z=$order.total_discount
}

{foreach from=$order.items item="item"}
	{$item.product_price}
	{$item.product_tax}
	{$item.product_quantity}
	
	{$item.product.product_reference}
	{$item.product.product_name}
	{$item.product.product_category_name}

	{if $item.product.additional_fields.brand}
		{$item.product.additional_fields.brand}
	{/if}
	
	{$item.product.variation.variation_reference}
	
	{if $item.product.variation.additional_fields.store_stock}
		{$item.product.variation.additional_fields.store_stock}
	{/if}
{/foreach}
 
{foreach from=$order.transactions item="transaction"}
	{$transaction.transaction_type}
{/foreach}
 
{foreach from=$order.transactions item="transaction"}
	{if $transaction.additional_fields.payment_subtype}
		{$transaction.additional_fields.payment_subtype}
	{/if}
{/foreach}
 
{if $order.additional_fields.order_browser}
 	{if $order.additional_fields.order_browser}
		{$order.additional_fields.order_browser}
	{/if}
{/if}

Tracking URL template example:

{* Basic Tracking *}
{math
    assign="order_amount"
    equation='x-y-z'
    x=$order.order_total
    y=$order.order_tax
    z=$order.total_discount
}
https://www.awin1.com/sread.php
    ?merchant={$config.awin_id}
        &amount={$order_amount}
        &ref={$order.id}
        &tt=ss
        &tv=2
        &ch=aw
        &cr={$order.currency_code}
        &vc={$order.coupon_code}
        &parts={if $order.user_id > 0}EXISTING{else}NEW{/if}:{$order_amount}
        &testmode=1

{* Product Level Tracking *}
{counter assign="i" start=0}
{foreach from=$order.items item="item"}
    {math
        assign="item_amount"
        equation='x*y'
        x=$item.product_price
        y=$item.product_quantity
    }
    {capture assign="key"}[{$i}]{/capture}
    {capture assign="value"}AW:P|{$config.awin_id}|{$order.id}|{$item.product.variation.variation_reference}|{$item.product.product_name}|{$item_amount}|{$item.product_quantity}||DEFAULT|{$item.product.product_category_name}{/capture}
    &bd{$key|escape:"url"}={$value|escape:"url"}
{/foreach}

📘

This example requires "Remove white spaces from the tracking URL" to be enabled.

📘

Use the escape template modifier to encode text values e.g.

{foreach from=$order.items item="item"}
	{$item.product.product_category_name|escape"url"}
{/foreach}

Template Validation and Debugging

When selecting the "Use Tracking URL Template" option, Aurora will use the last placed order to render an example tracking URL using your template e.g.

If there are errors in your template, these will be displayed according e.g.

📘

Please ensure that your tracking URL template is free from errors before enabling the "Send transactions" options.

📘

Please note that if Aurora encounters an error with your tracking URL whilst attempting to send a tracking request, an error will be logged to the Aurora error log.