Lead source data for Looker Studio and Google Sheets, from a read-only API
A read-only JSON API for the numbers on your TraceLead dashboard: sessions and leads by channel, source, campaign and landing page, and each lead's attribution, for Google Sheets, Looker Studio or your own reports.
No card needed. No lead caps on any plan.
Added by TraceLead's hidden fields. The name and email stay in your form.
- Channel
- Paid search
- Source / medium
- google / cpc
- Campaign
- brand-uk
- Click ID
- gclid
Lead source in Looker Studio without exporting a CRM
Looker Studio and Sheets reports usually get leads by exporting them from the CRM, which brings names and emails along, or from analytics, which counts conversions without the campaign that started them.
The TraceLead API returns only the attribution: counts per channel and campaign, and per-lead rows without names, emails or form answers.
-
Read only: three
GETendpoints, no write routes. -
Organisation tokens with the
report:readability, shown once, revocable. -
60 requests a minute per token;
401for a bad token,404for another organisation's site. - Attribution columns only: never visitor or session ids, click id values or contact details.
How to pull UTM leads into Google Sheets
Three steps, then a daily trigger keeps the sheet current. Looker Studio reads the same sheet.
The full API reference-
Create a token
As an owner, open the organisation page, find Reporting API and create a token. Copy it now: it starts with
tlapi_and is shown once. Send it as a bearer token:curl -H "Authorization: Bearer tlapi_…" https://app.tracelead.io/api/v1/sites -
Add the script to your sheet
In Google Sheets, open Extensions → Apps Script and paste the script from the guide. Its core is one call:
const response = UrlFetchApp.fetch( `https://app.tracelead.io/api/v1/sites/${SITE}/stats?group_by=channel`, { headers: { Authorization: `Bearer ${TOKEN}` } }, ); const rows = JSON.parse(response.getContentText()).rows .map((row) => [row.label, row.sessions, row.leads, row.conversion_rate]);Keep the token in Project Settings → Script properties if others can open the sheet.
-
Connect Looker Studio
Run the script on a daily trigger with
group_by=dayandgroup_by=channelwritten to two tabs, then in Looker Studio choose Add data → Google Sheets.
Lead attribution API endpoints
Periods are whole UTC days, from and to as YYYY-MM-DD, the last 30 days by default and at most 366 days. Stats come with the period of the same length before.
The machine-readable description is an OpenAPI 3.1 file at /schemas/report-api.v1.json.
| Endpoint | Returns |
|---|---|
| GET /api/v1/sites | The organisation's sites: public id, name, status, domains, created date. |
| GET /api/v1/sites/{public_id}/stats | Totals and one breakdown. group_by: channel, source, campaign, term, content, landing_page, referrer_host, form, day |
| GET /api/v1/sites/{public_id}/leads | Lead attribution rows, newest first, 100 per page with a cursor. Filters: from, to, channel, form_id. |
Attribution without personal data. No names, emails, form values, IP addresses or user agents. Ever.
No privacy workarounds. Nothing before consent, no fingerprinting, no ad-blocker bypass, no cross-site identity.
Made in the UK. GBP pricing, UK consent rules in mind, and a person who answers email.
Questions, answered
Anything else? Email us and a person replies.
How do I get lead source data into Looker Studio?
Looker Studio reads Google Sheets directly, so the simplest route is the Apps Script in the guide on a daily trigger, writing the stats endpoint with group_by=day and group_by=channel to two tabs, then Add data → Google Sheets in Looker Studio. A community JSON connector pointed at the stats endpoint with an Authorization header works too; TraceLead does not publish its own connector.
How do I import UTM leads into Google Sheets?
Open Extensions → Apps Script in the sheet, paste the script from the guide, set your token and site id, and run it or attach a daily trigger. It calls the stats endpoint and writes channel, sessions, leads and conversion rate into a TraceLead tab. The leads endpoint gives one row per lead with its attribution.
What does the lead attribution API return?
For each lead: its id and time, the first-touch channel, source and medium, UTM campaign, term, content and id, which click id was present, the referring host, the landing page, the page and form it was sent from, and the first-touch time. 100 per page, newest first, with a cursor for the next page.
Can I export leads by channel?
Yes. GET /api/v1/sites/{public_id}/stats?group_by=channel returns sessions, leads and conversion rate per channel against the previous period, and the leads endpoint accepts a channel filter. The dashboard also exports any breakdown table as CSV.
Can the API change anything or return personal data?
No. Every endpoint is a GET; there are no write routes. It never returns names, email addresses, phone numbers, form answers, IP addresses, user agents, full referrer URLs, click id values, or visitor and session ids.
Who can create an API token?
Organisation owners, on the organisation page under Reporting API. A token starts with tlapi_, is shown once, carries the report:read ability and reads every site of the organisation. Revoke it there; the page shows when each token was last used.
More features
Your lead sources, in the sheet you already report from.
Install the tag, let the leads come in, then create a token on the organisation page and paste the Sheets script.
No card needed. Cancel any time.
GET https://app.tracelead.io/api/v1/sites/tl_…/stats?group_by=channel
Authorization: Bearer tlapi_…
{ "rows": [
{ "key": "paid_search", "label": "Paid search",
"sessions": 702, "leads": 31, "conversion_rate": 4.4 }
] }