Set Campaign UTMs
set_campaign_utmsSet or clear the UTM tracking parameters of ONE channel on a wizard campaign, merging into what the channel already stores.
KEYWORDS: utm, utms, set utm, change utm, utm_source, utm_medium, utm_campaign, utm_term, utm_content, tracking parameters, campaign override, UPDATE ME
USE THIS TOOL WHEN THE USER ASKS:
- "Set utm_source=Linkedin and utm_medium=paid-social on this campaign"
- "Fix the UPDATE ME placeholder in campaign X's UTMs"
- "Use utm_campaign=DG_Touch-3 on the LinkedIn channel"
INHERITANCE RULE - READ BEFORE ANSWERING ANY UTM QUESTION:
UTMs are inherited, never blank. A campaign channel with an empty stored
mapping does NOT have "no UTMs" - it tracks with the account's UTM defaults,
and where the account set nothing it tracks with the Metadata platform default.
Roughly half of all channel rows in production are in that inherited state.
NEVER report "no UTMs configured" from an empty stored field: report the
resolved value and its origin.
ORIGIN IS PER CHANNEL, not per key: a channel with an empty stored mapping
inherits the account default whole, so a channel whose resolved mapping differs
at all from that is stored on the campaign and every one of its values is an
override. The per-key `same_as_default` flag says whether that one key happens
to match the default anyway.
ORIGIN VALUES:
- campaign_override: stored on this campaign channel, differs from what it would inherit.
- account_default: inherited from this account's UTM defaults.
- platform_default: inherited from the Metadata-wide default (account set nothing).
- not_set: the channel really has no UTM mapping (non-sponsored channels only).
HONEST LIMIT: a campaign that stores a mapping identical to the default it
would inherit is reported as inherited. The platform returns resolved values
with no provenance, so that case cannot be distinguished - say so rather than
claiming the campaign has no override.
TRACKING TIMING AND TOKEN MEANING:
Leads using server-resolved campaign UTMs use the current saved mapping when the platform processes them, without waiting for an ad republish. Captured URL or caller-supplied values can follow a different ingestion path, so do not generalize this timing to every new lead. Native click-time macros retain values captured from the lead's click URL. Ad click URLs have a separate publication timeline: a draft uses the saved mapping at launch, and launched ads use it on their next campaign publish. Saving a launched Microsoft Ads campaign triggers a live UTM push. AD_NAME is a dynamic token, not necessarily an individual ad name: standard experiments use their ad group name when present, otherwise their creative name; native ad structures use the native ad's own name. CAMPAIGN_NAME uses the wizard campaign name. Saving a launched campaign can also queue an asynchronous existing-lead UTM refresh. Do not assume historical rows are immutable or that all old rows have already refreshed. Verify the saved mapping with get_campaign_utms and actual lead values and ingestion timing separately from live ad click URLs; a supplied or backfilled lead creation date alone does not prove when its UTMs were resolved.
INPUT:
- campaign_id: the WIZARD campaign id (from list_wizard_campaigns / search_campaigns_by_names).
- channel: the enabled channel to edit: LINKEDIN, FACEBOOK, INSTAGRAM, GOOGLE_ADS,
MICROSOFT_ADS or REDDIT. UTMs are stored per channel; call once per channel.
- utms: object of UTM key to value. Standard keys UTM_SOURCE, UTM_MEDIUM, UTM_TERM,
UTM_CAMPAIGN, UTM_CONTENT (utm_source style is accepted and normalised); other keys
are custom static parameters. A value is either literal text ("paid-social") or one
of the platform's dynamic tokens: AD_CHANNEL, AD_NAME,
CAMPAIGN_NAME, OFFER_TYPE, OFFER_FORM_NAME, AUDIENCE_NAME_OR_KEYWORD, EXPERIMENT_ID,
EXPERIMENT_NAME, NATIVE_CHANNEL_CAMPAIGN_ID, NATIVE_CHANNEL_ADGROUP_ID,
NATIVE_CHANNEL_CREATIVE_ID, NATIVE_CHANNEL_KEYWORD, NATIVE_CHANNEL_SEARCH_TERM.
Keys you omit keep their current value; an empty string clears a key (the channel
then inherits that key's default again only if the whole mapping becomes empty).
`metadata_cid` is reserved and refused.
HOW IT WRITES: the platform endpoint replaces the campaign's whole UTM map and blanks
any enabled channel left out of it, so this tool reads the current mappings first and
re-sends every other enabled channel unchanged. A channel that was inheriting the
account default is re-sent with the same values it already resolves to, so tracking
does not change for it.
Saving changes the mapping used for incoming server-resolved leads immediately;
no ad republish is required for those leads. Publishing ad click URLs is separate.
Verify the stored mapping with get_campaign_utms and observed lead values separately.
RESPONSE SHAPE:
{"success": true, "campaign_id": 173290, "channel": "LINKEDIN",
"applied": {"set": {"UTM_SOURCE": "Linkedin"}, "cleared": []},
"stored_mapping": {...}, "resolved": {...same shape as get_campaign_utms.channels.LINKEDIN...},
"notes": ["..."]}
Account-level UTM defaults are NOT edited here (get_account_utm_defaults is read-only).Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| utms | Yes | UTM key to value, e.g. {"UTM_SOURCE": "Linkedin", "UTM_MEDIUM": "paid-social", "UTM_CAMPAIGN": "DG_Touch-3_TAG", "UTM_CONTENT": "AD_NAME"}. Empty string clears a key. | |
| channel | Yes | The enabled channel whose UTM mapping to edit. | |
| campaign_id | Yes | Wizard campaign id (the `id` from list_wizard_campaigns). |