HTML
Install the Trakily script on any website by pasting one tag into the <head>.
The examples use placeholders. In the app, Settings → Tracking shows the same snippet with your website id (it starts with pls_) and domain already filled in, so copy it from there.
Install
- 1
Paste the script inside the
<head>of every page. If your pages share a header template or layout, add it there once. - 2
Deploy, then open your site once to send the first visit.
<script defer data-website-id="pls_…" data-domain="example.com" src="https://trakily.com/js/script.js" ></script>
Script attributes
The script reads all of its settings from its own tag. Only the first two are required.
| Attribute | What it does |
|---|---|
data-website-id | Your site's public id (pls_…). Required. |
data-domain | Your main domain, without www. Required. Used to set the cookie domain and to tell your own links from outbound links. |
data-allowed-hostnames | Comma-separated list of your other domains, for cross-domain tracking. |
data-api-url | Where to send events. Only needed when you proxy events through a custom path (see Managed proxy). |
data-allow-localhost | Set to true to track on localhost. |
data-allow-file-protocol | Set to true to track pages opened from file: URLs. |
data-disable-payments | Set to true to stop the script from reading checkout ids on success pages (see Revenue). |
data-debug | Set to true to log every event to the browser console. |
- Attribute
data-website-id- What it does
- Your site's public id (pls_…). Required.
- Attribute
data-domain- What it does
- Your main domain, without www. Required. Used to set the cookie domain and to tell your own links from outbound links.
- Attribute
data-allowed-hostnames- What it does
- Comma-separated list of your other domains, for cross-domain tracking.
- Attribute
data-api-url- What it does
- Where to send events. Only needed when you proxy events through a custom path (see Managed proxy).
- Attribute
data-allow-localhost- What it does
- Set to
trueto track on localhost.
- Attribute
data-allow-file-protocol- What it does
- Set to
trueto track pages opened fromfile:URLs.
- Attribute
data-disable-payments- What it does
- Set to
trueto stop the script from reading checkout ids on success pages (see Revenue).
- Attribute
data-debug- What it does
- Set to
trueto log every event to the browser console.
Want the cookieless build instead? Turn on Track without cookies in Settings → Tracking, which switches the src to https://trakily.com/js/script.cookieless.js. See Cookies and cookieless mode.
Check the install
Open your live site in a normal browser window, then go to Settings → Tracking in Trakily. The status line switches from Waiting for the first event… to Receiving events within a few seconds of your visit.
Still waiting? Add data-debug="true" to the script tag and open the browser console: every event is logged with a [trakily] prefix, and if tracking is disabled the log says why (missing attributes, localhost, iframe, bot or trakily_ignore). The Quickstart lists the common causes.