All guides
Website tracking
A snippet that captures page views, clicks, form fills and custom events — and ties them to contacts.
Settings & dataabout 5 min
By the end you'll be able to
- Install the tracking snippet on your site
- Restrict tracking to your own domains
- Watch events arrive and debug an install
- Send your own custom events from your code
- See a contact's browsing history on their record
Walk through it
0 of 8 steps done0%
Each brand has its own public key, carried on the script tag. Copy the snippet for the brand whose website you are instrumenting.
Good to know
- Clicks are named by their visible text, so an icon-only button shows up as whatever glyph it contains. Add aria-label (better for everyone) or data-zenia-name="Export CSV" to the element to give it a proper name in the log.
- The event log holds the newest 20 events only — it is for checking an install, not a permanent record. The full history lives on each contact's timeline, and the totals live on the Website analytics page.
- Page views also record the device type, browser, operating system, screen size, language and timezone, which is what the Website analytics page breaks your audience down by. Device, browser and OS are read from the User-Agent on the request rather than from the page, so a caller cannot claim to be something it is not. Known crawlers are marked as bots and left out of the analytics by default.
- The list of refused requests is remembered in memory, so it empties on its own after a while and whenever you change the allowed domains.
- Until you add at least one allowed domain, tracking is unrestricted: anyone who copies your public key out of your page source could send events into your brand. The page shows a warning while that is the case.
- Removing a domain stops its events within a minute — there is no need to change the snippet.
- Add localhost if you want events from a site you are running on your own machine.
- The script is the same file for every brand and is cached hard by browsers, so it costs your visitors one download rather than a request per page. You can serve your own copy from a CDN if you prefer; the allowed-domains check still applies.
- Snippets installed before this changed keep working — the older tracking-code URL now serves the same cached script.