Skip to content

Track conversions with the JS snippet — Business plan, Phase 2 (coming soon)

Create a publishable key (Settings → API keys → Publishable) with your site's origins, then add the snippet:

Create a publishable key (Settings → API keys → Publishable) with your site's origins, then add the snippet:

<script async src="https://static.urlcrop.com/uc.js" data-key="uc_pub_…"></script>

The snippet stores the ucid click id from your URLs in a first-party cookie (_ucid, 90 days). Report what happens next:

urlcrop.track('lead', { external_id: 'lead_8812' });
urlcrop.track('purchase', { order_id: 'SHOP-10045', value: { amount: 249900, currency: 'INR' }, coupon_code: 'PRIYA10' });
urlcrop.identify({ external_id: 'cust_41', email_hash: '<sha256 of lower-cased email>' });

To tag a visit, send people to a link with ?ucid= in the URL: the snippet reads it, stores it in _ucid (and in localStorage as a fallback) and urlcrop.getClickId() returns it. Without data-key the snippet sends nothing.

Under the hood every call is a POST /v1/collect with the publishable key; the key can only write snippet events for your workspace from your allow-listed origins.