Integration Testing

Overview

♪ When to test
♪ You can do the test yourself, at any time!
♪ The Test Link will always be the same, except your ID, Email, and URL.
♪ Run a test including a purchase.
♪ Check the results email; then iterate and test again.
♪ See below for the standard error messages to determine success / failure.
♪ Troubleshooting
    ♫ What to look for
    ♫ How to check the Order Details array in Dev Console
    ♫ Save / view HTML and check for missing scripts
    ♫ Variables not expanding
    ♫ Firewall, AdBlockers, etc.
♪ Shopify Test Mode

 

When to test

If you are integrating with AvantLInk for the first time, then you should complete a tracking test, to confirm that the integration is complete.

If you have any doubts as to your system tracking, you should place a test to confirm.

If you update or change anything on your merchant site, such as a new theme, new eCommerce platform, you should run a test.

You should set a scheduled reminder to check sales / run a test once every 90 days or so, to confirm your tracking is working.

 

DIY

Good news! You can run a tracking test at any time on your program.

This test can and must be done by your team.

Your eCommerce platform may support a test mode, or test credit card numbers. For example, Shopify has a test mode, but it prevents real orders from being placed, so use with caution!
 

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 [brackets] -- that's part of the placeholder.)

    ♪ Your [MERCHANT_ID] should be 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. 
    ♪ Your [EMAIL_ADDRESS] will be your email address to receive the test notification at. Do not use other people's email address. If you have a web team making these tests for you, they should use their own email address.
    ♪ 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. The URL should be "percent encoded", but I think it works without it as well. If you get errors you may want to ensure it's encoded. You can use https://www.url-encode-decode.com to encode your landing page.

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

 

How to run a Test

Use the test link above.

Add an item to your cart, and complete the checkout process. You can use a real credit card, but be sure to cancel the sale on your fulfillment / backend! (AvantLink cancels the 'commission' on our side automatically.)

!Important -- Either stay on the Thank You page, or save the Thank You page as HTML.  (see below)

Check the result below; make changes and test again until you get a success

 

Results

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, that is bad.
    That means the SKU on your feed, and the SKU in your eCommerce system, are not the same. This will only
    prevent Item Names from showing up on the Item Reporting (you will only see SKUs), and will prevent Item
    Based Commissioning from working correctly.

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. 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.

 

Shopify Test Mode

• Shopify allows a test mode, but the test mode will prevent actual users from placing an order. I recommend doing this during your slowest hours, or doing it quickly to ensure that no customers are impacted.
• Please read over this guide to ensure you're aware of the Credit Card number to use for testing, etc: https://help.shopify.com/manual/payments/shopify-payments/testing-shopify-payments

• Enable/Disable 'Test Mode' can be done via Shopify Dashboard > Settings > Shopify Payments > Edit > check the box > save.

 

Have more questions? Submit a request
Powered by Zendesk