integration-astro-static

Integrate Amplitude analytics into Astro static sites using the Unified SDK.

28|Updated Dec 5, 2025
One-click install
npx skills add https://github.com/amplitude/wizard --skill integration-astro-static-amplitude
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: integration-astro-static
Source: https://github.com/amplitude/wizard/tree/main/skills/integration/integration-astro-static
Command: npx skills add https://github.com/amplitude/wizard --skill integration-astro-static-amplitude

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Amplitude integration for Astro (Static) helps you add Amplitude analytics to Astro static sites (SSG), enabling event tracking and data collection without server-side code.

Core Features & Use Cases

  • Unified SDK initialization with initAll() for browser-based analytics
  • Auto-capture of sessions and events via the Unified SDK
  • Easy setup using an Astro component (amplitude.astro) and environment variables

Quick Start

Install dependencies, set PUBLIC_AMPLITUDE_API_KEY, and start the Astro server to load Amplitude via the provided amplitude component.

Frequently Asked Questions about integration-astro-static

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add Amplitude analytics to an Astro static site?

To add Amplitude analytics to an Astro static site, use the Unified SDK initialized via `initAll()` with an environment variable API key. A provided `amplitude.astro` component loads the analytics client-side without requiring server-side code.

Can I use Amplitude event tracking with Astro SSG without a backend?

Yes, you can use Amplitude event tracking with Astro SSG without a backend. The browser Unified SDK initializes entirely on the client side, enabling event-based tracking and data collection directly from static pages.

What is the best way to set up Amplitude autocapture in an Astro project?

The best way to set up Amplitude autocapture in an Astro project is using the Unified SDK's `initAll()` method. This automatically captures sessions and events following Amplitude best practices for user identification and safe event properties.

How does the Amplitude Unified SDK handle user identification in static sites?

The Amplitude Unified SDK handles user identification in static sites by following Amplitude best practices during client-side initialization. The `amplitude.astro` component configures user tracking and safe event properties using the browser Unified SDK.

Do I need environment variables to initialize Amplitude in Astro?

Yes, you need the `PUBLIC_AMPLITUDE_API_KEY` environment variable to initialize Amplitude in Astro. Set this variable, install dependencies, and start the Astro server to load analytics via the provided component.

Why use the browser Unified SDK for Astro static site analytics?

You use the browser Unified SDK for Astro static site analytics because it enables client-side event tracking without server-side code. It provides autocapture of sessions and events specifically designed for static SSG environments.