Skip to main content

Install the browser SDK

collect.js is one script on the organiser's site. It records page views and what visitors do, and sends them to the ingest service in batches, as plain tracking calls. It knows nothing of the catalogue: what a call becomes is decided on the server, so a new mapping never needs a new SDK.

<script>
!function(){var e=window.evx=window.evx||[];e.q=e.q||[];
["page","track","identify","consent"].forEach(function(m){
e[m]=function(){e.q.push([m,[].slice.call(arguments)])}});
var s=document.createElement("script");s.async=1;
s.src="https://api.evtx.nl/v1/collect.js";
s.dataset.key="pk_live_…";
document.head.appendChild(s)}();

evx.page();
</script>

Calls made before the script has loaded are queued and replayed. The snippet is all a site needs; everything else is configuration on the server. The ingest service serves the script itself, so it sends to the host it came from and needs no data-endpoint. The organiser's workspace settings in the CRM show this snippet with the key filled in.

Script attributes​

AttributeMeaning
data-keyThe browser key (pk_live_…). Public by design; see write keys.
data-endpointWhere to send. Default: the host the script came from.
data-debugLog to the console what the server made of each call. ?evx_debug=1 on the page does the same.
data-evx-owner (on any element)With a group key: the owner of this page, as evx:…. Else the key's path-to-owner map decides.

Under 8 KB​

The script stays under 8 KB gzipped. It never throws into the page: every public call is wrapped.

Already on Segment or RudderStack?​

Point that SDK at the ingest service as its data-plane URL, with the organiser's browser key as writeKey. The service accepts the same paths and messages; only the consent-first behaviour and the shop-link decoration below are specific to collect.js.