Integration Testing

Overview

  • You can perform a tracking test yourself, at any time!
  • Tracking tests work exactly like an affiliate link, which uses our test affiliate account (ID 101) - and auto-cancels the order on our end.
  • Test results will be sent to the email in your test URL (below)
  • You may designate a specific landing page for the tracking test (important for staging servers / sub-domains)

When to test

  • If you are integrating with AvantLink for the first time, then you should complete a tracking test.
  • If you have any doubts as to your system tracking (drop in conversion), you should place a test to confirm.
  • If you update or change anything on your merchant site, such as a new theme, or new eCommerce platform, you should run a test to ensure the tracking code is intact.

Testing Steps

Please read through the following steps before initiating a test.

  1. Generate and click your program's test link. (next section)
  2. (troubleshooting) check your developer console for a cookie called "avmws" If this does not exist, your site-wide script may not be triggering correctly.
  3. Within 10 minutes of clicking the test link, place a test order on your site (must be greater than $0)
  4. (troubleshooting) On the final "thank you" page, right click a blank area of the page, and choose "save page as" - then if you receive a test failure, you can send the HTML file to our support team to ensure the code is being rendered properly. 
  5. Check your email for the test result.
  6. Make sure to cancel the order in your e-Commerce system.

Generating Your Test Link

The test link will always be the same for your program.

http://tracking.avantlink.com/docs/order.php?mi=[MERCHANT_ID]&em=[EMAIL_ADDRESS]&url=[PROGRAM_URL]

Simply replace the [MERCHANT_ID] with your Merchant ID, the [EMAIL_ADDRESS] with your email address, and the [PROGRAM_URL] with the landing page. (You should remove the placeholder [brackets] )

  • Your [MERCHANT_ID] is a 5 digit number. It is part of the Site ID you may have used for placing the site-wide tracking script, but without the '10' in front of it.
  • The [EMAIL_ADDRESS] is where the test results will be sent. Please only enter your email address here.
  • Your [PROGRAM_URL] will be your landing page -- either your homepage (live / production environment) or your test / staging URL. This is important because it sets the tracking cookie on the landing page.
    • You must complete the purchase on the same domain as the landing page.
    • If you have extra symbols in the URL, please ensure they are encoded. You can use https://www.url-encode-decode.com to encode your landing page URL.

Examples:

http://tracking.avantlink.com/docs/order.php?mi=123456&em=jdoe@example.org&url=https%3A%2F%2Fexample.org%2F

http://tracking.avantlink.com/docs/order.php?mi=654321&em=john.doe@example.org&url=https%3A%2F%2Fstaging.example.org%2F

 

Result Messages

Emails will go out after doing a test. Check to see which status you get:

1. Failure - no call made

    Result: FAILURE
    Error: No viable order tracking call was made during the period of time designated for this test.

This indicates a hard failure -- the script did not fire or track the sale. You must troubleshoot, change the  script and try again.

2. Successful tracking but No Product Feed in place

    Result: FAILURE
    Tracking Request: (tracking URL)
    Request Details: (details)
    Order Items:
    SKU: 123456, Qty: 1, Price: 74.95, Name: MISSING
    Error: Unable to locate one or more order item detail product SKUs in the merchant product
    datafeed(s)....

    This indicates a SUCCESSFUL tracking test. We receive the a correct, proper test, with all of the information
    (including Item Details). However, the SKU is not found in your product datafeed we have on file.

    This is common for first-time integrations, if you don't have a product feed set up with us.

If you get this error when you do have a feed set up, or are testing for Item Based Commission, this means the SKU on your feed, and the SKU in your eCommerce system, do not match.

This will only prevent Item Names from showing up on the Item Reporting (you will still see SKUs), and will prevent Item Based Commissioning from working correctly. If you do not plan on utilizing item based commission, correcting this is optional.

3. No Item Details

    Result: FAILURE
   
Tracking Request: (tracking URL)
    Request Details: (details)
    Error: No order item details were supplied for this sale.

    This indicates that we only received the Order Details (_Avantmetrics Order array "Order ID", "Order Total")
    and we did NOT receive any of the Item details (the _AvantMetrics Item arrays).

    You should check your for-each item in items loop; as well as the specific variables for your ecommerce to
    report item details to us.

    Some eCommerce systems do not have the ability to report item details to us. If that's the case, this is a
    successful test. 

    However, our system expects item details. If you are not passing item details to us, we must change the "Do
    Order Item Details?" flag from YES to NO on our side -- please contact Support or your Account Manager to
    handle that.

4. Coupon Code

    Result: FAILURE
    Tracking Request: (tracking URL including ecc= in the url)
    Request Details: (details)
    Error: Unknown or invalid exclusive coupon code, AVANT10OFF; ignoring ECC data.

This indicates that you're passing a Coupon Code ("Exclusive Coupon Code" or ECC) to us, but that is not
configured in your Merchant Links / Coupon Codes with us. This is a SUCCESSFUL tracking test, but we just
don't see that coupon code code. This is common if the code is a test code. This will still track in our system, even if that code is not provided to us.

 

5. Batch Sales (Item Details_

    Result: FAILURE
    Tracking Request: (tracking URL)
    Request Details: (details)
    Error: Attempted batch data input for a merchant not setup for batch sales.

    This means you are passing us Item Details, but our system is NOT configured to accept them. Consider
    this a successful test, and let AvantLink Support to know to turn on the Item Details!

 

5. Success

    Result: SUCCESS

    If you see this, it is an unqualified success. Everything is tracking how it should be. Good job!

 

Troubleshooting

You got a failure in your test. Now what?

You should try changing the code and test again. But, how do you know what to change? Here's how you figure it out.

If you have a tech team, now is a good time to ensure they're involved / helping. If you don't, then you may have to do some googling / following the steps below, or even hiring a temporary outsourced tech, or asking someone more comfortable with tech to help.

 

What to look for

Our tracking requires 2 scripts to work.

1. The 'site-wide tracking script' should be included on every page on your site (including the Order Confirmation page). We recommend putting this at the very bottom of your HTML DOM. This is the 'cdn.avmws.com' script.

2. The 'order details script' should be included on your Thank You / Order Confirmation page. It must fire BEFORE the site-wide tracking script; as such, this is usually placed immediately above the 'Site-wide script' on that 'Thank You' page. The 'order details' script is the _AvantMetrics object, which is building the Order and Item arrays, and as such, you'll want to ensure you're using a "for each" loop for each item (for the _AvantMetrics.push[('item')] line), as well as properly passing the variables from your specific e-commerce to our script. 

When you are troubleshooting the failure, you should be looking for these two scripts in the HTML of your code.

 

On Thank You Page / Dev Console

Did you stay on the Thank You page? Good job -- this is a powerful way to test.

1. Open the Developer Console. This is usually F12 or Ctrl Option K (on Mac). You can google how to do it if you're having a hard time.

2. Under the JavaScript Console, you can type "_AvantMetrics" (without the quote). You should get an Object back, with at least 2 arrays -- an Order array, and an Item array for every item on the order. If you get an "undefined" error, this indicates the Order details (the _AvantMetrics script) is NOT working correctly. Try changing that.

3. Under the 'Elements' tab, you should search for "avmws" to find the cdn.avmws.com script (the site wide script), as well as search for "_AvantMetrics" to find the Order Details script. If either are missing, be sure to change / add those. Also, you MUST ensure that the site-wide script (avmws) is coming AFTER the Order Details script (_AvantMetrics array).

 

In File > Save as HTML

If you're saving this, you can quickly use CTRL+F to search within that file to see if you see the cdn.avmws.com and the _Avantmetrics scripts. Make sure they are in the correct order!

Note: You want to use the Dev Console Elements, and NOT "Inspect Source" / CTRL+U to look for this. If you're using a tag manager, you will not see those scripts, since they are called dynamically when the page is loaded in a browser.

 

Common Errors

* The site-wide script (avmws) is firing before the Order Details (_AvantMetrics) is ready. If this happens, it can't get the order details to report the sale. The _AvantMetrics array must fire first.

* Variables not expanding -- if you are seeing, for example: $orderId, transaction.getTotal($orderId), {{order.total}} or similar, then your variables are not expanding properly. This is usually because they don't exist, are mistyped, or you may be using the wrong language (PHP vs JavaScript).

* Incorrect URL - if you're testing your staging site, but the test takes you to your Production homepage, it is NOT correctly setting the 'avmws' tracking cookie. You must use url= in the test link.

* AdBlockers - These will prevent tests from tracking. Please disable your AdBlock, or use a non-adblock browser or Incognito mode to prevent using plugins.

Have more questions? Submit a request