Track ecommerce events

Record product views, add to cart, checkout started and payment submitted from your site, to see where visitors give up before buying.

Besides page views, the script can record four steps of the purchase. They show where visitors give up, and they give attribution more information to work with. On Shopify, the Clakta Script records these for you. On other stores, a developer adds the calls below.

The four events

All of them come from the same package, and none of them need the script id again:

Product view

Call it on a product page:

Add to cart

Checkout started

Payment submitted

Send it when the shopper submits payment, before you know if it was approved:

Fields Clakta reads

Products: id, name, price, currency, quantity

Orders and carts: orderId, token, email, currency, value, lineItems

Anything else you send is kept as extra information. Prices are plain numbers in the main unit (29.99, not 2999), and currencies use the three-letter code, such as USD.

In privacy-friendly projects, don't send email: it is personal data that mode doesn't collect.

Custom events

For anything outside the purchase steps:

The first value is your own name for what you are tracking (a button, a section), the second is the kind of event, and the third is optional extra information.

Where to put the calls

  • Product view: when the product page opens, including when the visitor moves between products without reloading the page.
  • Add to cart: after the product was actually added, not on the click, or failed attempts are counted too.
  • Checkout started: when the checkout page first shows.
  • Payment submitted: when the payment form is sent, right before the visitor goes to the payment provider.

You can call them before the script finishes loading: Clakta holds them and sends them as soon as it is ready.

Start the script with debug: true while you set this up. Every event then shows in the browser console as it is sent.

Related articles