> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aiola.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Set Up Analytics

> Enable analytics for a project, embed the tracker, and connect search and revenue data.

## 1. Enable analytics

Go to **Project Settings → Analytics**. If analytics is not enabled yet, use **Enable Analytics** first.

## 2. Add the tracking script

Copy the script from the **Embed Script** section and place it in your site's `<head>`.

If you have not set a domain yet, Aiola gives you a CDN-based embed. Once you set a domain, the page switches to a first-party proxy pattern.

## 3. Optional: proxy around ad blockers

When a domain is configured, the settings page provides Next.js rewrites for:

* `/js/analytics.js`
* `/api/collect`

This lets your own domain proxy the analytics script and event endpoint.

## 4. Clean the data

Before considering setup complete, add exclusions for any traffic you do not want counted:

* your own IP
* internal paths
* hostnames
* countries

## 5. Connect search providers

Open **Project Settings → Integrations** and connect:

* Google Search Console
* Bing Webmaster Tools

Then return to **Analytics settings** and pick the property or site for the current project.

## 6. Connect Stripe revenue tracking

If the app uses Stripe, connect Stripe first and then make sure your checkout session metadata includes:

* `aiola_visitor_id`
* `aiola_session_id`

Aiola uses those cookies to attribute revenue back to tracked visitor sessions.

## 7. Verify the dashboard

After traffic starts flowing, confirm the project appears correctly in:

* **Project → Analytics**
* **Central → Analytics**

Also verify the configured currency, search mappings, and revenue attribution if those are part of your setup.
