@atmyapp/astro is a minimal Astro integration for AtMyApp that injects managed head metadata at build time and exposes a ready-to-use browser client for analytics events.
npm install @atmyapp/astro- Add environment variables to your
.envfile:
ATMYAPP_API_KEY=your-public-api-key
ATMYAPP_SITE_ID=your-site-id
ATMYAPP_BASE_URL=https://api.atmyapp.com- Add the head component once in your base layout:
---
import { AtMyAppHead } from "@atmyapp/astro/components";
---
<html>
<head>
<AtMyAppHead />
</head>
<body>
<slot />
</body>
</html>- Optional: track page views automatically:
<AtMyAppHead trackPageView />import { getClient } from "@atmyapp/astro/client";
await getClient().analytics.trackEvent("button_click");
await getClient().analytics.trackCustomEvent("form_submit", {
form_id: "contact",
});ATMYAPP_API_KEY(required in build mode)ATMYAPP_SITE_ID(required in build mode)ATMYAPP_BASE_URL(optional, defaults tohttps://api.atmyapp.com)DEV_MODE(0enables build-time head fetch; any other value skips it)
You can find your Site ID in the AtMyApp dashboard under your site/project settings.
- Build-time head API fetch is skipped.
- Missing credentials only warn (no hard failure).
window.__ATMYAPP__is still injected so browser-sidegetClient()works when credentials are present.
After setup, all SEO and head metadata can be managed from the AtMyApp dashboard. No additional code changes are needed for normal metadata updates.