Traffic

TL;DR

Visitors per day per domain, split by source and medium. It supplies visit measures alongside order measures when analysing conversion.

Traffic is the daily website statistic per domain: active users, sessions and revenue, broken down by where the visit came from. It arrives from GA4 through the same proxy that answers the per-order source and medium, and it is the only object in CCC that counts visits rather than transactions.

Where it comes from

app/jobs/googleanalytics/gettraffic.php consumes the googleanalytics_traffic batch type. A batch carries a date, and the job asks the proxy's trafficacquisitionperday endpoint once per domain, using that domain's ga4_property from config/reference/domains.json. A domain with no property configured there cannot be asked for traffic, and no other setting supplies one.

Unlike the per-order source and medium, this call does take a date, so traffic can be backfilled for a day by re-queueing that day. See GA4 for why the order-level call cannot.

Tables

TableHolds
trafficstatisticsOne row per date, domain, source and medium
trafficsources, trafficmediumsThe tidied source and medium each row resolves to
trafficsourceraw, trafficmediumrawThe raw upstream values and what they map to
trafficsourcemediumshardmatchesRaw pairs that are rewritten before mapping

The raw value that arrived is kept beside the resolved one, so a row whose mapping looks wrong can be read back to what GA4 actually said.

How a source and medium is resolved

The same resolution used for orders: an empty value becomes unknown, a raw pair matched in trafficsourcemediumshardmatches is rewritten first, the source is then looked up and falls back to Other, and the medium is looked up and falls back to Unknown. A source may force a medium, which overrides whatever medium arrived. See source and medium for the full chain and where each mapping is maintained.

Where to look, and where to change

WhatWhere
The daily figures/transactions/traffic, filtered on date range and domain
The mappings behind the resolved values/entities/sourcemediums and its tabs
The domains and their GA4 properties/entities/domains, configured in config/reference/domains.json

The figures are upstream data. The mappings are CCC's own and are what you change when a source is landing in the wrong bucket.

Evidence

Import from app/jobs/googleanalytics/gettraffic.php and app/models/googleanalytics.php, which builds the trafficacquisitionperday call from the domain's property. Domain properties from config/reference/domains.json. Joins and columns from app/models/traffic.php and templates/main/transactions/traffic.tpl. Resolution chain from sourcemediums->buildsourcemediums(). Basis: code-checked against the current implementation.

About this document