Astro
Add the tag to the <head> of your base layout. Astro bundles and rewrites <script> tags by default, so mark it is:inline to keep it as written:
src/layouts/Base.astro
---
const { title } = Astro.props;
---
<html lang="en">
<head>
<meta charset="utf-8" />
<title>{title}</title>
<script is:inline defer src="https://lynq.byharsh.com/js/lynq.js" data-site="your-site.com" data-vitals></script>
</head>
<body>
<slot />
</body>
</html>View transitions
With <ClientRouter /> (view transitions), Astro swaps pages without a full load. Lynq watches the History API, so each navigation is still a pageview. See single-page apps.
Custom events
From an inline script or an island, call window.lynq.track(name, props) once the page has loaded. The TypeScript declaration types it.