Skip to content

Latest commit

 

History

History
65 lines (46 loc) · 2.02 KB

File metadata and controls

65 lines (46 loc) · 2.02 KB

Agent Analytics Examples

Real example projects that show how to integrate Agent Analytics into websites, storefronts, tools, and other product surfaces.

Examples

Astro Velvet Paw

Path: examples/astro-velvet-paw

A fictional ecommerce / affiliate storefront for premium cat sneakers. It demonstrates a focused Agent Analytics integration for a static storefront:

  • tracker snippet installation
  • automatic page/session/referrer/UTM/device context
  • declarative CTA clicks with data-aa-event
  • section impressions with data-aa-impression
  • runtime events with window.aa.track(...)
  • outbound merchant-click conversion tracking
  • an experiment seam with window.aa.experiment(...)
  • opt-in performance, Core Web Vitals, scroll depth, and time-on-page signals

Primary KPI: outbound_merchant_click.

The example intentionally avoids fake cart, checkout, purchase, login, and order lifecycle events. Checkout happens on the merchant site, so the honest conversion is the shopper's merchant handoff.

Running an example

cd examples/astro-velvet-paw
npm install
npm run dev
npm test
npm run check
npm run build

Repository layout

examples/
  astro-velvet-paw/
    src/
    tests/
    public/

Using these examples with a real Agent Analytics project

Each example ships with placeholder project credentials. Create an Agent Analytics project, then replace the placeholder values in the example's tracker snippet before deploying.

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

For live verification, use the Agent Analytics CLI:

npx --yes @agent-analytics/cli@0.5.21 events your-project --days 7 --limit 20

Design rule for examples

Examples should be product-first. They should look and read like the surface they represent, while the analytics integration stays visible in code and documentation. Avoid adding fake lifecycle events just to show more tracking surface.