yourdomain.com; do not include https://, a path, or a port.
Enabling analytics creates the project’s Tracking ID. The Domain is required both when enabling analytics and afterward: the collector rejects every event until a valid domain is saved.
1
1. Embed Script (required)
Add the following tag to the The direct script posts to Aiola’s collector and preserves accurate visitor IP exclusions, country/city data, and map data.
<head> shared by every page. Replace YOUR_TRACKING_ID with the Tracking ID shown in Settings → Analytics and replace yourdomain.com with the saved domain.2
2. Ad-block Bypass (optional)
For a Next.js site, add these rewrites to Then use this tag instead of the tag from step 1:
next.config.ts:3
3. Bot / AI Crawler Tracking (optional — pick ONE)
AI crawlers never execute JavaScript, so the browser tag cannot see them. Choose exactly one server-side or edge implementation for the stack that receives every page request. These calls post directly to The snippets test the User-Agent before sending anything, skip static assets, keep
https://aiola.app/api/bot-crawl-ingest; ad blockers do not apply.- Next.js / Vercel
- Cloudflare Pages Function
- Express / Node.js
Add both sections below. Middleware records normal crawler requests and forwards the requested path;
app/not-found.tsx records crawler 404s because middleware runs before the response status is known.robots.txt, llms.txt, and sitemap requests, send country in the JSON body when the platform provides it, and report status codes where the stack can observe them.Use Add to App
The Add to App button in the analytics settings header opens an AI thread with the current Tracking ID, Domain, and endpoints. Its prompt first inspects the project to detect the real framework and runtime, then:- installs the browser tag at the correct global layout, template, or entry point
- avoids duplicating an existing Aiola integration
- can add the optional same-domain proxy using the stack’s native rewrite mechanism
- can add optional server-side or edge bot tracking at the request interception point, including 404 handling where supported
- adds Stripe cookie metadata when Stripe is connected, or shows the manual revenue option otherwise
Tracker attributes
Add these attributes to the single installed script tag when needed:data-site-id="YOUR_TRACKING_ID"selects the project and is required.data-domain="yourdomain.com"allows that exact hostname and its subdomains. If the current hostname is not allowed, the tracker exits without sending.data-domains="one.example.com,two.example.com"adds a comma-separated list of allowed hostnames; each entry also allows its subdomains.data-host-url="/api/collect"overrides the defaulthttps://aiola.app/api/collect-analyticsendpoint. The ad-block bypass tag uses this.data-track-query="true"counts a query-string-only URL change as a new pageview. It is off by default;url_queryis still sent with events either way.data-track-hash="true"includes the hash in the tracked path and counts hash-router navigation.data-do-not-track="true"makes the tracker honor the browser’s Do Not Track setting.
Custom events, identity, and manual revenue
After the script loads, use the global API:window.aiola.track(name, props) and window.aiola.identify(id, props). Event names are limited to 100 characters, and oversized event properties are discarded if their serialized data exceeds 6,000 characters.
You can also track a click declaratively:
aiola_visitor_id with a 365-day cookie expiry and aiola_session_id with a sliding 30-minute expiry. Both use SameSite=Lax, path=/, and Secure on HTTPS. The visitor ID also uses local storage as a fallback.
Exclude unwanted traffic
Configure exclusions in Settings → Analytics:- IP addresses: one IPv4 or IPv6 address, or an IPv4 CIDR range such as
203.0.113.0/24. - Paths: an exact path such as
/admin, or a prefix ending in*, such as/admin/*. Query strings are not used for path matching. - Countries: visitors whose signed worker geo resolves to the selected two-letter country code.
- Hostnames: an exact hostname and all its subdomains, such as
preview.yourdomain.com.
Connect search keywords
- Open Settings → Integrations and connect Google Search Console and/or Bing Webmaster Tools.
- Return to Settings → Analytics → Search Keywords.
- Select the Google Search Console property and Bing Webmaster site for this project. If multiple connected accounts exist, the selector groups properties by account.
Connect Stripe revenue
Connect Stripe from Settings → Integrations. Once the analytics setting shows Connected, pass the tracker cookies as Checkout Session metadata so the webhook can attribute revenue to the correct visitor and marketing channel.Security and data management
- Attack Mode: enables stricter bot and headless-browser detection, per-IP limits, and per-site limits. Use it when analytics is receiving spam or the site is under attack.
- Export: downloads CSV for this month, last month, the current or previous year, or a custom month range. An export is truncated at 100,000 rows; narrow the range if that happens.
- Import: Fix CSV with AI converts a CSV from another provider into Aiola’s UTC schema and saves the fixed file to Downloads for re-upload. Direct Import (auto-detect) imports CSV or TSV directly.
- Clear Data: permanently deletes all pageviews, events, sessions, charts, breakdowns, and historical analytics for the project. Export first if the data may be needed.
- Disable Analytics: pauses collection while preserving existing data. Re-enable it later to resume collection.
Aiola stores timestamps in UTC and displays them in the workspace timezone configured in Central settings. Imported local timestamps must be converted to UTC.
Verify collection
After deployment:- Visit the production domain and navigate between a few pages.
- Open the project’s Analytics dashboard and verify visitors, sessions, and Views.
- Open the realtime globe to confirm the active visitor and event stream.
- If crawler tracking is installed, test the server route with a matching crawler User-Agent and verify the AI view. The browser tag alone cannot perform this test.
- If Stripe or search providers are connected, verify the selected property/site and the Checkout Session metadata before expecting attribution.
- Use the project dashboard’s Analyze with AI action to open a reporting thread for a preset or custom date range.
Retention is not a dashboard section. Request it through the Aiola MCP by calling
get_analytics with the analytics_retention pipe and the workspace timezone.Monthly plan usage is based on billable events: pageviews and custom events, excluding
_leave, _identify, and _scroll. If the monthly limit is exceeded, the dashboard is locked until upgrade or reset, but collection continues and no data is lost.
