Skip to content

At-My-App/astro

Repository files navigation

@atmyapp/astro

@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.

Installation

npm install @atmyapp/astro

3-step setup

  1. Add environment variables to your .env file:
ATMYAPP_API_KEY=your-public-api-key
ATMYAPP_SITE_ID=your-site-id
ATMYAPP_BASE_URL=https://api.atmyapp.com
  1. Add the head component once in your base layout:
---
import { AtMyAppHead } from "@atmyapp/astro/components";
---

<html>
  <head>
    <AtMyAppHead />
  </head>
  <body>
    <slot />
  </body>
</html>
  1. Optional: track page views automatically:
<AtMyAppHead trackPageView />

Send custom events from the browser

import { getClient } from "@atmyapp/astro/client";

await getClient().analytics.trackEvent("button_click");
await getClient().analytics.trackCustomEvent("form_submit", {
  form_id: "contact",
});

Environment variables

  • ATMYAPP_API_KEY (required in build mode)
  • ATMYAPP_SITE_ID (required in build mode)
  • ATMYAPP_BASE_URL (optional, defaults to https://api.atmyapp.com)
  • DEV_MODE (0 enables build-time head fetch; any other value skips it)

You can find your Site ID in the AtMyApp dashboard under your site/project settings.

Dev mode behavior

  • Build-time head API fetch is skipped.
  • Missing credentials only warn (no hard failure).
  • window.__ATMYAPP__ is still injected so browser-side getClient() works when credentials are present.

Head configuration source of truth

After setup, all SEO and head metadata can be managed from the AtMyApp dashboard. No additional code changes are needed for normal metadata updates.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors