Install with a script tag
Use the hosted script when your site has no JavaScript build step or package manager — static sites, landing pages, CMS templates, or any HTML you control directly. Everything the browser SDK does (pageviews, engagement, custom events, privacy mode) is available through one tag.
Add the snippet
Paste the snippet into every page of your site, right before </head>, with the App ID and Ingest key from Settings → Installation:
<script
defer
src="https://cdn.nexly.to/js/script.js"
data-app-id="your-app-id"
data-key="your-ingest-key"
></script>
Add your production domain to Settings → Ingest → Allowed origins, the same as for any browser install. The installation guide in the dashboard generates this snippet with your credentials and chosen tracking options filled in — pick the Script tag card under Choose your framework.
What it tracks
By default the script sends a pageview when the page loads and attaches engagement tracking (clicks, scroll depth, visibility, active time).
Single-page applications are handled automatically: the script watches History API navigations (pushState, replaceState, and back/forward) and sends a pageview whenever the path changes. On classic multi-page sites every page load counts as a pageview, as usual.
Options
Configure the script with attributes on the same tag:
data-privacy-mode— enable privacy mode: no browser storage is used for identifiers.data-outbound-links— also track clicks on outbound links, file downloads, andmailto:/tel:links.data-auto-pageview="false"— do not send the automatic pageview; callwindow.nexly.pageview('/path')yourself.data-engagement="false"— do not attach engagement tracking.data-spa="false"— do not track History API navigations.
Custom events
After the script loads, the client is available as the nexly global:
<script>
window.nexly?.customEvent('cta_clicked', { placement: 'hero' })
</script>
Custom event names and properties follow the same rules as the npm SDKs — see Custom events and properties.
When to use an npm package instead
If your project already uses npm and a bundler, prefer the matching package (@nexly/web, @nexly/react-web, @nexly/next): you get typed APIs, direct access to pageview() and customEvent() without the global, and version pinning through your lockfile. See Choose an SDK.
Verify the install
Open your site, navigate a page, and check the property setup page or the events feed. If no event arrives, confirm the allowed origin, credentials, and whether ingestion is paused.