All integrations

Astro

Put the tag in the layout that wraps every page.

Steps

  1. Open your base layout, usually src/layouts/Layout.astro.
  2. Paste the script tag inside <head>. Replace SITE_ID with your Site ID.
  3. Keep the defer attribute. A script tag with attributes like defer is left as-is by Astro, not bundled.
  4. Deploy.

The snippet

Replace SITE_ID with the ID from your Glyphex site settings.

---
// src/layouts/Layout.astro
---
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>My site</title>
    <script defer src="https://glyphex.io/t/SITE_ID.js"></script>
  </head>
  <body>
    <slot />
  </body>
</html>

If you use <ClientRouter /> (Astro view transitions), navigations use the History API and are tracked automatically.

Verify it works

Open your live site in a new tab, then open Realtime in your Glyphex dashboard. Your visit should show up within a few seconds. You can also open your site's Getting started page and click Check installation, which fetches your URL and looks for the tag.

Cookies and consent

Glyphex sets no cookies and stores nothing on the visitor's device, so it needs no cookie banner.

Track custom events

Add the data attributes to any element in your templates:

<button
  data-glyphex-event="signup_click"
  data-glyphex-event-plan="pro"
>
  Sign up
</button>

Events can also be sent with window.analytics.track(name, props) or the declarative data-glyphex-event and data-glyphex-event-<prop> attributes.

Troubleshooting

  • No data? Check that the Site ID matches exactly and the page was republished or the cache cleared.
  • Ad blockers can block analytics scripts. Disable yours to test.
  • Content Security Policy: allow https://glyphex.io in both script-src and connect-src.
  • Check DevTools > Network for a request to glyphex.io/t/. A 404 means the Site ID is wrong.