Installing the Clerk.io Order Tracking Script for Custom Order Types

How to make sure your orders are tracked when the conversion happens outside of your webshop.

Order Tracking is used to report on Clerk.io’s performance and give our algorithms feedback to constantly learn about your customers.

If your webshop utilizes a custom order type, such as a “click-and-collect” option, Order Tracking is still needed to track those activities in your store. To do so, insert your store’s Order Tracking code in your theme files, within the confirmation page that customers are led to after the click-and-collect pathway is chosen.

The standard template for Order Tracking looks like the one below:

<span
class="clerk"
data-api="log/sale"
data-sale="ORDER_ID"
data-email="CUSTOMER_EMAIL"
data-products='[{"id": PRODUCT1_ID, "quantity": PRODUCT1_QTY, "price": PRODUCT1_PRICE}, {"id": PRODUCT2_ID, "quantity": PRODUCT2_QTY, "price": PRODUCT2_PRICE}]'> </span>

You can find the appropriate placeholders using the setup guide for your webshop in my.clerk.io.

If the Visitor Tracking is not already firing on your Confirmation Page, be sure to also add this script to that page in your theme files as well (replacing “INSERT_API_KEY” with your webshop’s API Key):

<!-- Start of Clerk.io E-commerce Personalisation tool - www.clerk.io -->
<script type="text/javascript"> (function(w,d){ var e=d.createElement('script');e.type='text/javascript';e.async=true; e.src=(d.location.protocol=='https:'?'https':'http')+'://cdn.clerk.io/clerk.js'; var s=d.getElementsByTagName('script')[0];s.parentNode.insertBefore(e,s); w.__clerk_q=w.__clerk_q||[];w.Clerk=w.Clerk||function(){w.__clerk_q.push(arguments)}; })(window,document); Clerk('config', { key: 'INSERT_API_KEY' }); </script>
<!-- End of Clerk.io E-commerce Personalisation tool - www.clerk.io -->

Once the these are entered on the appropriate confirmation page in your theme files, your webshop’s custom order types will now register as a “sale”.