Skip to content

Paginated visit/session feed

projectId
required
string
page
integer
default: 1 >= 1
pageSize
integer
default: 20 >= 1 <= 100
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.

search
string

Paginated visit feed. Two code paths produce the SAME field set. Primary path reads D1 visit_attributions. If that returns total === 0, the service falls back to Analytics Engine visit rows; in that fallback id is the synthetic “ae:::<sessionId|‘’>”, ip/userAgent/shortLink are always null, deviceType defaults to “UNKNOWN”, clickIds is at most a single-entry map, and createdAt is the ClickHouse datetime string “YYYY-MM-DD HH:MM:SS”. On the D1 path createdAt is normalizeUtcTimestamp(…) of the stored value (ISO-8601 UTC) with the raw stored string as fallback, and userAgent is hardcoded null in both paths. clickIds keys are ad-platform click-ID parameter names (gclid, fbclid, bd_vid, …) — an open-ended map of string→string.

Media typeapplication/json
object
visits
required
Array<object>
object
id
required
string
sessionId
required

Empty string when unknown

string
visitorId
required

Empty string when unknown (D1 path)

string
userId
required
string | null
landingUrl
required

Empty string when unknown

string
referrer
required
string | null
utmSource
required
string | null
utmMedium
required
string | null
utmCampaign
required
string | null
country
required
string | null
deviceType
required
string
clickIds
required

Map of ad-platform click-ID parameter name → value; keys are open-ended.

object | null
ip
required
string | null
userAgent
required

Always null (not persisted / not selected)

null
createdAt
required

D1 path: ISO-8601 UTC (normalized), raw stored string as fallback. AE fallback path: “YYYY-MM-DD HH:MM:SS”.

string
shortLink
required

Always null on the AE fallback path.

object
id
required
string
name
required
string | null
shortCode
required
string
campaign
required
object
id
required
string
name
required
string
adPlatformConfig
required
object
id
required
string
name
required
string
platform
required
string
total
required

Total matching visits (D1 COUNT, or filtered AE row count on the fallback path).

integer