Amami MCP docs

Tracking and events

Amami uses the same basic tracking model as Umami-style analytics: create a website, add a tracking script, then collect pageviews and events. The difference is that an AI assistant can guide the setup and verify the result.

Website tracking

After MCP setup, ask your agent:

Create a tracked website for this project, give me the tracking script, and tell me exactly where to add it.

The script uses this shape:

<script defer src="https://dashboard.amami.dev/script.js" data-website-id="WEBSITE_ID"></script>

Add it to the HTML head or the framework-specific app shell that renders on every public page.

Tracking code options

The basic snippet can include optional attributes:

<script
  defer
  src="https://dashboard.amami.dev/script.js"
  data-website-id="WEBSITE_ID"
  data-domains="example.com"
  data-auto-track="true"
></script>
  • data-website-id: required website identifier.
  • data-domains: optional production-domain allowlist to avoid local or preview data.
  • data-auto-track: controls automatic pageview tracking.

Use data-domains for production sites when possible.

Framework placement

For static HTML, place the script in the shared <head>.

For Next.js App Router, place it in the root layout:

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        {children}
        <script
          defer
          src="https://dashboard.amami.dev/script.js"
          data-website-id="WEBSITE_ID"
          data-domains="example.com"
        />
      </body>
    </html>
  );
}

For React, Vue, Svelte, Astro, Remix, Framer, Webflow, Ghost, and WordPress, the rule is the same: install the script in the shared shell or site-wide custom code area so every public page can send pageviews.

For SPAs, verify route changes. If automatic tracking does not capture client-side navigation in your setup, send manual pageviews or ask your agent to add a route-change hook.

What pageview tracking gives you

Once the script is installed, Amami can analyze:

  • Which pages receive traffic.
  • Which sources send visitors.
  • Which countries, devices, browsers, and operating systems appear.
  • How traffic changes across date ranges.
  • Whether recent deployment or content changes changed visitor behavior.

Event tracking

Pageviews tell you what people read. Events tell you what people did.

Track events for actions such as:

  • Signup button clicks.
  • Install button clicks.
  • Pricing page CTA clicks.
  • Documentation copy-button usage.
  • Form submissions.
  • Product activation steps.
  • Checkout or upgrade actions.

With write tools enabled, the MCP server can expose event ingestion and test-event tools. Ask:

Send a test event for the signup CTA and confirm Amami can read it.

Client-side event shape:

umami.track('signup_cta_click', {
  placement: 'hero',
  plan: 'starter'
});

Prefer stable event names and properties over prose-like names. Keep personal data out of event properties.

UTM and campaign analysis

Use UTM parameters for campaigns, launches, social posts, newsletters, and paid experiments. Amami can help compare campaign performance through referrer, UTM, page, event, and conversion signals.

Ask:

Compare my GitHub, docs, X, newsletter, and Product Hunt traffic. Which source brings visitors most likely to click signup?

Verification checklist

  • The tracked website exists.
  • The script is installed on public pages.
  • Pageviews are visible after visiting the site.
  • Important conversion events are named consistently.
  • UTM links are used for launches and campaigns.
  • The assistant can run list_websites, get_stats, get_pageviews, and event-related tools.

Troubleshooting

If data does not appear:

  • Confirm the data-website-id matches the website in Amami.
  • Confirm the script URL is reachable in the browser network panel.
  • Confirm ad blockers are not blocking local testing.
  • Confirm data-domains does not exclude your current hostname.
  • Confirm the script is present on the rendered page, not only in a component that never mounts.
  • For SPAs, navigate between routes and verify pageviews update.