Matching sessions to ads
Every session with paid attribution is assigned to the most specific ad entity 3x can prove. A new
visit is matched right away: when its page load arrives with click ids or UTM parameters, and
again when a lead or conversion is stored for it. The ads.match_recent job catches anything left
over on every scheduler tick, and the ads.match job re-evaluates the last 90 days whenever
entities, URL tags or rules change. All of them use the same rules and write the same result
(session_ad_match): the platform, account, campaign, ad set, ad and the method that matched.
While a lead's visit has no stored match yet, reports attribute the lead provisionally with the
same rules (UTM ids, URL tags, campaign names) and mark it – pendingLeads in the ads report,
pending on Pulse sources, Zuordnung läuft in the dashboard – until the match is stored.
Methods (first match wins)
| # | Method | Evidence | Precision |
|---|---|---|---|
| 1 | click_id | gclid/gbraid/wbraid found in Google's click view | exact ad and keyword |
| 2 | utm_id | UTM values that are platform ids of imported campaigns/ad sets/ads (templates) | exact |
| 3 | utm_map | the literal UTM combination configured on an ad (Meta URL parameters, TikTok landing URLs, LinkedIn URLs, Google suffixes and templates) | exact, or the deepest common parent when several ads share it |
| 4 | name | normalized utm_campaign equals a campaign name (umlauts transliterated, punctuation → -) | campaign; only when unique per platform and account |
| 5 | manual | your mapping rules, highest priority first | as configured |
| 6 | manual_entity | a UTM id equals a campaign, ad set or ad you named by hand (ad account not connected) | the named entity; ad set and ad ids from the link |
| 7 | platform | only the platform is known (click id or a source alias like fb, ig, li) | platform |
A match that stops above ad level is then refined within its campaign (and ad set, when the link
names it): utm_content (and utm_term outside Google) equal to one ad's own URL tag gives utm_map,
equal to the slug of one ad's name or its distinctive codes gives name_slug (confidence high, or
medium for codes only). The refinement never replaces an id-based ad; ambiguous hits stay at
campaign / ad set level. Every match without an ad stores why (gap_reason) – see
Clean ad-level matching.
Platform-level matches still count for platform cost per session; they just cannot be broken down further.
Unmatched UTMs
Dashboard → Ads → Unmatched UTMs (GET /v1/projects/{project}/ads/unmatched, MCP ads_unmatched)
lists UTM combinations of paid sessions that matched only at platform level or not at all, with
session counts and the reason (reason, summed in reasons); level=ad lists the visits that know
the campaign or ad set but no ad. Typical causes:
- ads without URL parameters (add the template),
- hand-written campaign names that differ from the platform name (
spring-salevs. "Spring Sale 2026 – DE"), - links from organic posts of the same platform,
- old campaigns that were deleted before the first sync (entities are only imported while they exist).
Mapping rules
A rule maps a UTM pattern to an entity:
{
"platform": "meta_ads",
"accountId": "act_1234567890",
"match": { "utm_source": "fb", "utm_campaign": "spring-sale" },
"campaignId": "120210000000000001",
"adsetId": null,
"adId": null,
"priority": 10,
"note": "Spring campaign used hand-written UTMs"
}matchtakes any ofutm_source,utm_medium,utm_campaign,utm_content,utm_term,utm_id; all given keys must be equal (case-insensitive).- Higher
prioritywins when several rules fit. - Create rules from the unmatched view with one click, via
POST /v1/projects/{project}/ads/mapping-rules(scopeads:write) or MCPads_mapping_rules_create. Existing sessions are re-matched on the nextads.matchrun.
Unknown campaigns named by hand
Boosted Instagram or Facebook posts often run in a different ad account than the one connected
to X3 (a personal profile's boost, an agency account). Their clicks still carry ids –
utm_campaign/utm_id = campaign, utm_term = ad set, utm_content = ad (Meta's id template) –
but no synced entity has them: the visits match only at platform level, without name or spend.
- Settings → Ad accounts → Unknown campaigns (
GET /v1/projects/{project}/ads/unknown-campaigns, scopeads:read, MCPads_unknown_campaigns_list) lists paid visits whose campaign / ad set / ad ids belong to no synced entity and no name, grouped campaign → ad set → ad, with visits, interested visits, leads, first/last seen, landing page and platform. Which UTM key carries which id comes from the platform's id template and the URL templates of the project's synced ads. The placeholder label „Unbekannte Meta-Kampagne (…8718)“ is shown only there – reports never use an id as a name.include_ignored=truealso lists ids already named or ignored. - Name an id (
PUT /v1/projects/{project}/ads/manual-entities, scopeads:write, MCPads_manual_entities_upsert) withplatform,level(campaign,adset,ad),externalId, optionalparentExternalId,nameand – for campaigns – an optional estimatedspend(amount,currency,from,to). The write is idempotent per platform, level and id. Visits carrying the id are re-matched right away (rematch.statedone, orrunningwith a queuedmatchrun you can follow inads_sync_status); later visits match immediately (methodmanual_entity). Ignore an id withstate: "ignored"– it disappears from the list and never matches. - Estimated spend is spread evenly over the days of its range and counts in every cost metric
(CPL, cost per interested visit, budget). It is always flagged:
manualSpendon report rows and totals,kpis.spend.manualin Pulse, „geschätzt · manuell erfasst“ in the dashboard. It is never sent to an ad platform. - Synced entities always win. When the ad account is connected later, the next entity sync
supersedes the manual entry automatically: the synced name, spend and match are used, the estimate
is removed, and the entry shows a notice until acknowledged
(
POST /v1/projects/{project}/ads/manual-entities/{id}/acknowledge). If the synced entity disappears again (account removed), the manual entry becomes active again. Naming an id that is already synced is refused (409). - List or remove names with
GET /v1/projects/{project}/ads/manual-entities/DELETE /v1/projects/{project}/ads/manual-entities/{id}(MCPads_manual_entities_list/ads_manual_entities_delete). Every change is in the audit log.
Campaigns of other projects
When one ad account feeds several projects, choose the campaigns that count per project. A visit whose click id or UTM ids belong to a campaign excluded for this project gets no match here (not even at platform level), is not listed as an unknown campaign and does not count as an unmatched paid visit (rule).
Day alignment
Costs are stored per ad-account day, sessions per project day. With different time zones, a daily chart can shift spend by a few hours relative to sessions. Ranges of several days are practically unaffected. LinkedIn is always UTC.