Skip to main content

Overview

The AI Referrals API ingests pre-aggregated daily traffic that originated from AI assistants (ChatGPT, Claude, Perplexity, and so on) into Scrunch. Use it when your source of truth for web analytics is Adobe Analytics or another tool you’d like to push from on a schedule, rather than connecting Google Analytics directly. Once a connection is registered and events start landing, the AI Traffic dashboard and the Site Map’s ai_referrals metric prefer push data over any live-queried Google Analytics integration for the same website.

When to use the AI Referrals API

Use this API when you need to:
  • Send AI-sourced traffic from Adobe Analytics into Scrunch on a daily schedule.
  • Backfill historical AI referral data from any pre-aggregated source.
  • Power the AI Traffic dashboard for brands that don’t use Google Analytics.
If your team uses Google Analytics 4, connect it through the in-app integration instead — you don’t need this API. A brand cannot have both a Google Analytics integration and an active AI Referrals push connection on the same website at the same time.

How it works

  1. Register a connection for the (brand, website, provider) you’ll push from. Connections are scoped to one website each; register multiple connections if you push for several domains.
  2. Push events in batches against that connection. Each event is one row of pre-aggregated daily metrics — pageviews, sessions, transactions, and revenue — keyed by date, referrer, and page.
  3. Read results on the AI Traffic dashboard and via the Sitemap API’s ai_referrals totals.
Pushes are idempotent. The upsert key is (date, raw_referrer_value, raw_page_value) — resending the same tuple replaces the prior values, so retries and corrections are safe.

Authentication

All endpoints use Bearer-token authentication. Connection writes require the configure scope; listing requires the query scope.
Generate a key under Organization → Settings → API Keys in the Scrunch dashboard.

Endpoints

The list endpoint returns push connections only. Google Analytics integrations live in a separate system and don’t appear here, even when they’re the reason a register call returned 409.

Supported providers

The MVP allow-list is:
  • adobe_analytics
More providers will be added behind the same provider field — your code doesn’t need to change when the allow-list grows.

Event schema

Each event is one pre-aggregated daily row.

Example: register a connection

Response:
Save the returned id — you’ll use it as connection_id on every push.

Example: push a batch (JSON array)

Response:
Events whose raw_referrer_value doesn’t match Scrunch’s AI platform allow-list are counted in rejected rather than failing the whole batch.

Example: push a batch (NDJSON)

For larger batches, send newline-delimited JSON to reduce parser overhead:

Limits

  • 10,000 events per batch. Larger batches return 413 Payload Too Large — split and retry.
  • 5 MB request body. Same 413 behavior.
  • One active connection per (brand_id, website). Disable the existing connection or use a different website before re-registering.

Status codes


Best practices

  • Push once per day after your source tool has finalized the prior day’s data. The upsert key makes re-pushes safe, but daily granularity is enough for the dashboard.
  • Send raw referrer values straight from your source tool — don’t pre-normalize. Scrunch maps them to AI platforms server-side and that mapping evolves over time.
  • Include batch_id when you can. It makes it easier to correlate a push with your ETL run if you need to investigate later.
  • Back off on 429/5xx with exponential retry. Pushes are idempotent on the upsert key.
  • Don’t mix providers on one connection. Register one connection per (website, provider).