Overview
AvantLink tracking uses a small JavaScript library, first party cookies, and local storage to monitor visitors as they move through your site and track orders.
There are two scripts that need to be implemented to install AvantLink tracking:
- Sitewide Tracking Script
- Order Confirmation Script
Sitewide Tracking script
Script Placement
- Use this template to build the Sitewide Tracking Script.
- Insert the Sitewide Tracking script immediately before the closing BODY tag of every page on your website.
Order Confirmation script
Script Placement
- An example of this script with populated data is included at the end of this article.
- Insert the Order Confirmation script on the order confirmation page (the page that is displayed immediately after the sale is completed).
- It needs to be called when an order is completed.
- If your checkout process includes multiple payment methods (Paypal, Apple Pay, etc) ensure the Order Confirmation script is being called correctly for each payment method.
- Place the Order Confirmation script in the HEAD element of the order confirmation page. The site-wide tracking script needs to also be included on this page and should be placed right before the closing BODY tag of the page. In order for AvantLink tracking to work properly, the Order Confirmation script must be included on this page PRIOR to the Sitewide Tracking script.
- The Order Confirmation script consists of two arrays/parts that need to be updated with the data that is sent to AvantLink. The requirements for the arrays are outlined in the next section.
Order Confirmation Array Requirements
The data requirements for the two arrays in the Order Confirmation Script are outlined below:
1) Order Array
- Sends order data to AvantLink.
Variable |
Description |
Format |
Note |
order_id |
The number/ID that uniquely identifies the order. |
String |
Required |
amount |
Dollar amount subtotal for the order (not including tax or shipping fees). |
Decimal without dollar sign or commas. |
Required |
currency |
Currency type used on the order. |
3 letter ISO 4217 currency code. |
Required |
state |
State/Territory associated with the customer’s billing address. |
2 letter abbreviation. |
Recommended: Enables Tax Nexus Solution |
country |
Country associated with the customer's billing address. |
2 or 3 letter ISO 3166 country code. |
Recommended: Enables Tax Nexus Solution |
ecc |
Coupon code used with order. |
String |
Recommended: Enables the ability to report on coupon code use and to configure commission rules based on the coupon codes. |
new_customer |
Specify whether the customer is new or returning. |
“Y” or “N” Y = new customers N = existing customers. |
Recommended: enables the ability to report on new customers and to configure commission rules based on new customers. |
tax |
Dollar amount of tax charged for the order. |
Decimal without dollar sign or commas |
Optional |
shipping |
Dollar amount of shipping fees charged for the order. |
Decimal without dollar sign or commas. |
Optional |
2) Item Array:
- Sends product item details to AvantLink.
- There should be one Item Array for each product purchased on the order.
- The SKU’s passed in the Item Array should match what is used in your product datafeed.
Variable |
Value |
Format |
Note |
order_id |
The number/ID that uniquely identifies the order. |
String |
Required |
parent_sku |
The parent-level unique identifier, the SKU for each item. |
String |
Required |
variant_sku |
The variant-level (a.k.a. child-level) unique identifier for each item. This identifier is more specific (generally used for size/color/style level) |
String |
Recommended: Enables more detailed reporting and provides affiliates with more powerful product searches. |
price |
Dollar amount for one item of the SKU/product (including discounts, but not including tax or shipping fees). |
Decimal without dollar sign or commas. |
Required |
qty |
The quantity of each SKU/product sold on the order. |
Integer/Number |
Required |
Order Confirmation Script & Sitewide Script Example
Below is an example of the Order Confirmation script (with the data populated for the required and recommended fields) followed by the Sitewide Script.
html>
<head>
...
<script type="text/javascript">
var _AvantMetrics = _AvantMetrics || [];
_AvantMetrics.push(['order',{ order_id:'567', amount:'95.00', state:'UT', country:'USA', currency:'USD', new_customer:'N', ecc:'15OFF' }]);
_AvantMetrics.push(['item',{ order_id:'567', parent_sku:'abcde', variant_sku:'abcde-sm', price:'20.00', qty:'2' }]);
_AvantMetrics.push(['item',{ order_id:'567', parent_sku:'efghi', variant_sku:'efghi-blue', price:'10.50', qty:'1' }]);
_AvantMetrics.push(['item',{ order_id:'567', parent_sku:'jklmn', variant_sku:'345687319', price:'22.25', qty:'2' }]);
</script>
</head>
<body>
...
<script type="text/javascript">
(function() {var avm = document.createElement('script'); avm.type = 'text/javascript'; avm.async = true;
avm.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.avmws.com/1012345/';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(avm, s);})();
</script>
</body>
</html>