Skip to main content

Overview

Send Scrunch the visits your website gets from AI assistants (ChatGPT, Perplexity, Claude, Gemini and others), straight from the analytics tool you already use: Adobe Analytics, a data warehouse, a log pipeline, anything that can count daily sessions by referrer and page. You send one row per day, referrer and page. Scrunch shows it on the AI Referrals page, and in the Explorer and Scrunchie where AI referrals are on for your brand. You can also read your AI referral data back out: sessions, engagement, conversions and revenue by day, AI assistant, landing page and website, from Google Analytics 4 and the websites you send.
Beta. Sending rows is in beta. Talk to your Scrunch team before you build against the connection and event endpoints: they turn them on for your brand and help you set it up. Until they’re on, those endpoints return 404. Reading AI referral data isn’t part of the beta.
Using Google Analytics 4? Connect it in Integrations instead; you don’t need to send rows. A website reads from one source at a time, so a website with Google Analytics connected can’t also use this API (and the other way around).

How it works

  1. Register the website. One call per website returns a connection_id.
  2. Send daily rows to that connection, on whatever schedule suits you: a daily job, a pipeline, or several times a day. Sending a row again replaces it, so retries and corrections are safe.
  3. See the data in Scrunch. A day shows once it’s over (UTC).
All endpoints live under https://api.scrunchai.com/v1.

Authentication

Send an API key as a Bearer token. Create one in Scrunch under API Keys:
  • configure scope to register, disable and send rows.
  • query scope to list connections and read AI referral data.

Read AI referral data

GET /{brand_id}/ai-referrals returns the visits AI assistants sent to the brand’s websites, grouped by the dimensions you pick in fields. It reads the brand’s Google Analytics 4 connection and every website sent through this API, the same data the Explorer shows.
Every row carries sessions, views, engaged_sessions, engagement_rate, avg_engagement_time_per_session (seconds), new_users, key_events, converted_sessions, conversion_rate, transactions and revenue. Rates run from 0 to 1. revenue is in meta.currency_code.
  • Freshness. Scrunch copies the brand’s Google Analytics data once a day. Rows run up to yesterday in each website’s time zone, so today isn’t included.
  • Missing days. A day not loaded yet reads null. Grouped by date and ai_platform only, an assistant with no visits on a loaded day reads 0.
  • Key events leave out Google Analytics’ automatic events and the events the brand turned off in Scrunch.
  • Traffic-only websites. A website sent through this API without the six optional engagement fields reads null for engaged_sessions, new_users, key_events, converted_sessions and the rates.
  • Matching the AI Referrals page. Numbers can differ slightly from Scrunch’s AI Referrals page, which reads Google Analytics live.
A 400 means a value in fields isn’t a dimension, start_date is after end_date, or start_date is before 2015-08-14. A 404 means the brand doesn’t exist. A 409 means the brand’s websites report revenue in different currencies.

Register a website

  • website must be one of the brand’s websites in Scrunch.
  • provider is a label for where the data comes from: use "custom" for any tool. "adobe_analytics" is also accepted. Both are read the same way.
The response includes the connection id: use it as connection_id when you send rows. Each website has one active connection at a time.

Send rows

Send a JSON array (Content-Type: application/json) or one row per line (Content-Type: application/x-ndjson), up to 10,000 rows and 5 MB per call, and up to 120 calls a minute per brand.
A row whose referrer isn’t an AI assistant (google.com, say) is counted in rejected with its reason in errors; the rest of the call still goes through.

Row fields

* All six or none. Send users, new_users, engaged_sessions, engagement_seconds, key_events and converted_sessions together on every row, or leave all six out. Leave them out and Scrunch shows traffic and revenue only for that website. A connection keeps the choice its first rows made: to change it, disable the connection, register the website again and send its history the new way. Replacing rows. A row is identified by date, raw_referrer_value and raw_page_value. Sending the same three again replaces the earlier values. Pages are compared as sent, so https://www.example.com/pricing and /pricing are two rows (both count as /pricing in Scrunch).

Status codes

When a call stores nothing because of its rows (a 400, 409 or 422, or every row rejected), the reason is kept on the connection as last_push_error, and last_pushed_at says when rows last arrived. Listing connections shows both; the next call that stores rows clears the error.

Tips

  • Send finished days. A day shows in Scrunch once it’s over; re-send a day if your tool revises it.
  • Retry freely. Sending the same rows again replaces them, so a retry never double-counts.
  • Keep raw values. Send referrers and pages as your tool reports them.
  • Set batch_id to tie rows to the run that sent them.