Click Tracking

How to add click tracking to DOM elements not rendered by Clerk.js

Tracking what products from Clerk.io consumers actually click on is the cornerstone of our AIs feedback loop and analytics dashboard.

Any template rendered via Clerk.js has click tracking on all products by default.

If you have rendered HTML via server-side API calls you can still use Clerk.js to add click tracking by doing the following:

  1. For each root element of a product add the attribute data-clerk-product-id containing the products ID.
  2. After the page has loaded make the following JavaScript call Clerk("click", "*[data-clerk-product-id]");.

This will add click tracking to any clickable element in the rendered products.