@typedtrack/astro
v0.1.0
Published
Astro integration (astro:config:setup + injectScript automatic pageview tracking) for typetrack.
Maintainers
Readme
@typedtrack/astro
Astro integration (astro:config:setup + injectScript automatic pageview tracking) for typetrack.
Install
bun add typetrack @typedtrack/astroRequires Astro 6/7.
Usage
// src/lib/analytics.ts
import { createAnalytics } from "typedtrack";
export default createAnalytics();// astro.config.mjs
import { defineConfig } from "astro/config";
import typetrackAstro from "@typedtrack/astro";
export default defineConfig({
integrations: [
typetrackAstro({ analyticsModule: "/src/lib/analytics.ts" }),
],
});analyticsModule must point at an app-authored file that default-exports
a createAnalytics(...)-constructed instance — Astro ships zero client JS
by default (islands architecture), so this integration injects a script
tag that imports and uses that module directly, rather than relying on a
persistent component tree/context. Automatic pageview tracking is on by
default (autoPageViews: false to disable).
See docs/README.md for the full documentation index.
