Astro

Add the Lienks snippet to the layout of your Astro site.

Before you start

Create your site and copy its site ID first (see Quick start).

Add the snippet

Add the snippet to your layout (for example src/layouts/Layout.astro) inside the <head>. is:inline keeps Astro from processing the script:

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

Page views in your app

Astro pages are normal pages, so each one is counted when it loads. If you use Astro’s view transitions, Astro switches pages through the History API, and Lienks counts those changes automatically.

Track a custom event

Call window.lienks?.event('signup_clicked') wherever something should be counted. More in Custom events.

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

Check that it works

Open your site. The first pageview shows up in the dashboard. If nothing arrives, see Troubleshooting.