Cashline

Docs

Plain HTML

The snippet is first-party when you host cashline.js on the same origin as the site you measure. Replace YOUR_ORIGIN with the Cashline deploy that serves the script, or copy public/cashline.js onto your own domain.

Add the queue, then the script

Put this before </body> on every page you care about. data-site is the site ID from your trial or dashboard.

<script>
  window.cashline = window.cashline || function () {
    (window.cashline.q = window.cashline.q || []).push(arguments);
  };
</script>
<script src="https://YOUR_ORIGIN/cashline.js" data-site="cl_your_site_id"></script>
<script>
  cashline('pageview');
</script>

Fire a purchase after the processor confirms

Amount is rand, not cents. Only call this when Paystack (or your own webhook) says the charge succeeded.

cashline('purchase', {
  amount: 199,
  currency: 'ZAR',
  reference: 'ORD-1042'
});