Skip to content

Attribution report (organic/paid, first/last touch)

Also reachable by the internal remote-MCP server as get_attribution_report: the handler uses requireProjectRoleOrMcpScope(VIEWER, ‘mcp:attribution_read’). MCP access is mediated by a separate internal worker (x-worker-token), not by a directly-presented customer API key, so ApiKeyAuth is NOT advertised here.

projectId
required
string
startDate
string format: date

Inclusive window start (YYYY-MM-DD). Parsed with parseDateRangeParams; when either startDate or endDate is missing/invalid the route falls back to a rolling default window (30 days for events/visits/attribution, 7 days for growth).

endDate
string format: date

Inclusive window end (YYYY-MM-DD). See startDate for fallback behavior.

model
string
default: first

Attribution model (default “first”).

window
integer
default: 30

Attribution lookback window in days.

Attribution breakdown (dynamic shape). organic/paid touch entries are {source, count}; campaign entries add platform (the utmSource half of the “campaign::source” composite key, null when empty). Each list is capped at 10 entries, sorted by count DESC. _meta.model and _meta.window are pass-through echoes of the model / window query params and are NOT used to change the computation — window is Number(...) so it can be NaN, which JSON.stringify serializes as null. organic.* sources are classifier channel labels (e.g. “organic:google”) or the literal “直接访问”; paid.* sources are human labels from PAID_CLICK_ID_LABELS (Google Ads, Meta, 百度…) falling back to the raw click-ID key.

Media typeapplication/json
object
organic
required
object
firstTouch
required
Array<object>
<= 10 items
object
source
required
string
count
required
integer
lastTouch
required
Array<object>
<= 10 items
object
source
required
string
count
required
integer
paid
required
object
firstTouch
required
Array<object>
<= 10 items
object
source
required
string
count
required
integer
lastTouch
required
Array<object>
<= 10 items
object
source
required
string
count
required
integer
campaign
required
object
firstTouch
required
Array<object>
<= 10 items
object
source
required

Utm_campaign, or the literal “unknown”

string
platform
required

Utm_source of the touch; null when empty

string | null
count
required
integer
lastTouch
required
Array<object>
<= 10 items
object
source
required

Utm_campaign, or the literal “unknown”

string
platform
required

Utm_source of the touch; null when empty

string | null
count
required
integer
_meta
required
object
queryDurationMs
required
integer
model
required

Echo of the model query param; defaults to “first”. Not applied to the computation.

string
window
required

Echo of the window query param coerced with Number(); defaults to 30. Serializes as null if the param is non-numeric (NaN).

number | null
rowsAnalyzed
required

Number of visit AE rows fetched for the range

integer