Learn how to debug the sales-tracking part of Clerk.io
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.
In most cases, sales tracking fails due to errors in the visitor IDs or product IDs of the sale call that is send to Clerk after a purchase has been completed. To debug this, you'll have to make a test order. However, in some cases it might be related to the sales tracking script itself and can debugged by looking at the logs in my.clerk.io => Data => Logs as described below.
Start by going to your Clerk.io Dashboard, and go to Data -> Logs.
If the sales-tracking is failing because of an error in your script, you will often be able to see the error in the top of the page.
Click Details to see more:
If you cannot see any errors in logs, the easiest way to identify other sales-tracking issues is to place a test order.
Debugging with a test order
The below guide will use Chrome as an example to show how to debug sales tracking with a test order, but other browsers have similar features.
Start by putting a couple of products in the basket.
Proceed to Checkout.
Before placing the order, open your browsers Console.
Find Network, and narrow down results for "clerk".
Place the order, so you see the order confirmation page.
Click the call that starts with sale (normally sale?key=...) 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.
The product IDs send with the call do not exist in the data you have synced with Clerk.
Error 2: "Missing Argument X"
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:
Start by opening the Console in your browser
Type in "Clerk".
If Clerk.js has not been loaded correctly, you will see a ReferenceError: