Add one deferred script. Replace the site id with the public id from SiteLine, and the origin with your SiteLine app origin or your first-party proxy origin. Set data-endpoint to an absolute collect URL so events are not posted to your own site by mistake.
<script
defer
data-site-id="YOUR_SITE_ID"
data-endpoint="YOUR_SITELINE_ORIGIN/api/analytics/event"
src="YOUR_SITELINE_ORIGIN/js/script.js"
></script>
Optional attributes, off unless you set them:
- data-track-outbound-links="true" emits events when visitors click links to other hosts.
- data-track-file-downloads="true" emits events for common download extensions.
- data-file-download-extensions="pdf,zip" overrides that extension list.
- data-endpoint is the absolute or relative collect URL. When omitted, the script derives /api/analytics/event from the script src origin.
Pageviews start on load. The script does not set an analytics cookie. Hostname allowlists still apply: events from a host you did not register are rejected.
Install steps
- Register. The trial is 7 days and does not ask for a card. Plans start at $4.99/mo.
- Add the website you want to measure. Copy the public site id from the install screen. These docs write that id as YOUR_SITE_ID.
- Paste the deferred script above into the document. Set data-endpoint to an absolute URL on YOUR_SITELINE_ORIGIN so the browser does not post the event to the page you are measuring.
- Load the page once. The install screen leaves the waiting state when the first pageview arrives.
- Leave outbound links and file downloads off until you want those events. Each one is billable, the same as a pageview.
The script does not read a cookie and does not set one. If an ad blocker drops YOUR_SITELINE_ORIGIN, move the script and the collect URL behind a first-party proxy you operate. SiteLine does not create a CNAME for you.
Named actions use the same collect URL. Custom events keep the same limits: at most 10 property keys, 64 characters on a key, 256 on a string value. Do not put an email or an account id in a property.