Skip to content

Getting Started

This is the shortest path from zero to a working Agent Analytics setup.

The main flow is agent-first: choose Connect as agent, start in the AI agent you already use, let that agent open the browser for you or give you a login link, then have it create the project and wire tracking for you.

Use Connect as human only when you need direct account access yourself, such as billing, cancellation, or manual review. Browser approval and finish-code handoff still belong to the normal agent-owned setup flow.

If your AI agent, such as Claude Code, OpenWork, Cursor, Codex, or OpenClaw, is already installed and you want the clearest create-project, place-snippet, and verify-first-page-view walkthrough, use First Project in 5 Minutes.

If you want your agent to install analytics with product judgment instead of a generic event list, start with Product Growth Scanner. It returns the growth questions, measurement blind spots, minimum viable instrumentation, and what not to measure yet.

If you want to understand the two public skills first, start with Agent Analytics Skill for setup and reporting, then Autoresearch Growth Skill for data-informed variant generation.

Go to the installation hub and complete the setup for the environment you actually use:

If none of those are a fit, the API reference stays available for direct integration into your own runtime.

2. Open your AI agent in the project directory

Section titled “2. Open your AI agent in the project directory”

Start from the codebase or site you actually want to track.

Then ask your AI agent for the full setup flow:

  • Set up Agent Analytics for this project. Open the browser for me and wait while I sign in with Google or GitHub and approve it. Ask for a finish code only if the browser callback cannot resume you. Then create or identify the matching project, install the project-owned tracker, add only meaningful events tied to this repo's product workflows, explain what each event enables, and verify the first useful event.

When the browser approval page opens, sign in with Google or GitHub, approve it, and let the agent continue. That approval creates or connects your account and gives the agent the session it needs.

After your AI agent is connected, ask it to create the first project for you:

  • Create a project called my-site.com
  • Create a project called my-site.com and give me the tracking snippet

If your AI agent has code write access to your site, ask it:

  • Set up analytics for my-site.com. Analyze the public site first, then install only the first recommended events.

Your AI agent should create the project and either:

  • return the tracker snippet for you to paste, or
  • install the tracker itself if it can edit the site

If your AI agent already added the tracker to your site, skip this step.

If it only created the project and returned a snippet, add the script before </body>:

<script defer src="https://api.agentanalytics.sh/tracker.js"
data-project="my-site"
data-token="aat_..."></script>

The initial page view is tracked automatically. If your app is a SPA and you want route changes tracked automatically too, add data-track-spa="true" to the script tag; otherwise send intentional manual page calls for virtual screens.

Automatic URL fields are privacy-safe by default: url and referrer are sanitized to origin plus pathname, and automatic attribution only reads the allowlisted UTM keys utm_source, utm_medium, utm_campaign, utm_content, and utm_term. Add custom events later with data-aa-event attributes or window.aa.track().

If your product has login or signup, keep signup for the moment the account is actually created, preferably server-side. After auth succeeds in the browser, call window.aa.identify(account.id, { email: account.email }) only when you intentionally want support lookup by email. Use your stable app/account ID as the user ID, not the email address. Agent Analytics computes a project-scoped HMAC lookup on the server and strips raw email from event rows and profile traits by default.

Browser storage is project-scoped by token/name. Older unscoped anonymous IDs are not migrated, so a visitor may receive a new scoped anonymous ID after upgrading from an older tracker.

If your site uses Astro, add is:inline to that tracker tag.

For advanced tracker options like declarative events, cross-domain identity, consent, scroll depth, vitals, and error tracking, use the Tracker.js guide. If your app is a SPA, use SPA and Virtual Page Tracking to decide between data-track-spa="true" route tracking and manual virtual page_view calls. If you want your AI agent to launch your first browser-side A/B test after setup, continue with AI Agent Experiment Tracking.

Once the install is working and the tracker is live, ask your AI agent one of these:

  • List my projects
  • How is my-site doing this week?
  • What are the top pages for my-site this week?
  • Show bot traffic for my-site this week

If the setup is correct, the agent should answer without you hand-writing requests or opening a reporting UI.

If you need direct HTTP access for a server-side runtime that cannot use agent sessions, generate an API key from app.agentanalytics.sh. CLI, MCP, paid upgrades, and agent onboarding should use browser approval and agent sessions instead.

  • Use Installation for the fastest per-agent or per-workspace setup.
  • Use First Project in 5 Minutes when you want the full activation walkthrough from installed agent to first live project.
  • Use Product Growth Scanner when you want your agent to decide what to measure before it installs custom events.
  • Use Agent Analytics Skill when you want the regular skill for setup, reporting, and experiments.
  • Use Autoresearch Growth Skill when you want a loop that generates variants, tests approved experiments, and feeds the next run from measured behavior.
  • Use SPA and Virtual Page Tracking when your app changes screens client-side and you need accurate page tracking without double-counting.
  • Use AI Agent Experiment Tracking when you want your AI agent to launch and read browser-side experiments for you.
  • Use Tracker.js for browser-side tracking options.
  • Use Bot Traffic to inspect filtered automated callers separately from normal analytics.
  • Use Authentication when you need the read token vs write token rules.
  • Use API Reference when you need endpoint-level details.