Plain HTML

For static websites and hand-written HTML. There are separate guides for WordPress, Next.js and SvelteKit.

Add the snippet

<script defer src="https://app.lienks.com/a.js" data-site="YOUR_SITE_ID"></script>

Open your HTML file, find the <head> element and add the line anywhere between <head> and </head>, for example below your existing <meta> or <title> tags. That’s all you need.

Replace YOUR_SITE_ID with your site ID. The app shows the right one after you create the site (Quick start).

Use it on every page

The snippet has to be on every page you want counted.

If you have a shared layout, template or partial, add it there once. Otherwise add it to each HTML file.

Track a custom event

<button onclick="window.lienks?.event('signup_clicked')">Sign up</button>

The ?. means nothing happens instead of an error if the script didn’t load, for example because of an ad blocker.

Event names follow these rules:

  • The name starts with a lowercase letter, followed by lowercase letters, digits and underscores.
  • It is at most 100 characters long.
  • pageview is reserved.
  • Invalid names are discarded.

For more, see Custom events.

Check that it works

Open the page in your browser. The pageview shows up in the dashboard.

Tip: in the network tab of your developer tools you should see a POST to https://app.lienks.com/api/events.

If nothing arrives, see Troubleshooting.

Next steps