Clerk.io needs to continuously track sales from the webshop to keep results up-to-date with your customers' behaviour. 

However, some settings in a webshop may cause the sales-tracking to fail.

Below, you can find out how to debug the sales-tracking and see what the most common issues and solutions are.

Before you start

Make sure that you have installed:

These are required to track sales in general.

Debugging

The easiest way to identify a sales-tracking issue is to place a test-order.

The below guide will use Chrome as an example, but other browsers have similar features.

  1. Start by putting a couple of products in the basket.
  2. Proceed to Checkout.
  3. Before placing the order, open your browsers Console.
  4. Find Network, and narrow down results for "clerk".
  5. Place the order, so you see the order confirmation page.
  6. Click the sale?callback=...  call to see the details that are being sent to and received by the sales-tracking. By clicking Preview you can easily identify any errors that will cause sales to not be tracked.

Error 1: "Invalid Syntax In Argument: products"

This error happens if the product IDs you send have a wrong syntax.

The most common errors are:

  • The product-IDs are string-encoded in the sales-tracking, but you are using Integers in Clerk.io or vice-versa
  • The list of product IDs contain text-formatting characters like this: "products":[\"id"\:\"123-m"\]. The format should be pure JSON, to eliminate any formatting.

Error 2: "Missing Argument X"

This means that you are not sending all the data Clerk.io needs to track the sale.
Make sure you include all the data- attributes in the sales-tracking.

Error 3: Call is never made 

If you can't see the call to sale even with both scripts installed, then something has caused the Clerk.js script to be loaded incorrectly. To identify if this is the problem, try this:

  1. Start by opening the Console in your browser
  2. Type in "Clerk".
  3. If Clerk.js has not been loaded correctly, you will see a ReferenceError:

Usually, if Clerk.js has not been loaded, it's due to Require.js blocking the Clerk object.

To fix this, you need to include Clerk in Require.js.
This can be done by inserting require(['clerk'], function() {}); in the bottom of the Clerk.js tracking code:

<script type="text/javascript">
  window.clerkAsyncInit = function() {
      Clerk.config({
          key: 'gB8HMZTek8napebN6t7vDTj7yNkXTyI7'
      });
  };
  (function(){
      var e = document.createElement('script'); e.type='text/javascript'; e.async = true;
      e.src = document.location.protocol + '//api.clerk.io/static/clerk.js';
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(e, s);
  })();
  require(['clerk'], function() {});
</script>


If Clerk is still not available, you can force Require.js to ignore Clerk by inserting window.__clerk_ignore_requirejs = true;in the top of the tracking code:

<script type="text/javascript">
  window.__clerk_ignore_requirejs = true;
  window.clerkAsyncInit = function() {
      Clerk.config({
          key: 'gB8HMZTek8napebN6t7vDTj7yNkXTyI7'
      });
  };
  (function(){
      var e = document.createElement('script'); e.type='text/javascript'; e.async = true;
      e.src = document.location.protocol + '//api.clerk.io/static/clerk.js';
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(e, s);
  })();
</script>

Try each of these approaches and place a new test-order to see if sales are now being tracked.

Did this answer your question?