MMetadata /docs
Docs/Tools/set_campaign_utms

set_campaign_utms

Set or clear the UTM tracking parameters of ONE channel on a wizard campaign, merging into what the channel already stores.

Destructive campaigns

Deletes, archives, launches or moves budget. Do not give an agent this one without a human gate.

What it does

Set 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).

Arguments

ArgumentTypeNotes
campaign_id integer required Wizard campaign id (the `id` from list_wizard_campaigns).
channel string required The enabled channel whose UTM mapping to edit.
one of: LINKEDIN, FACEBOOK, INSTAGRAM, GOOGLE_ADS, MICROSOFT_ADS, REDDIT
utms object required 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.

Request

Request template, not a complete runnable example. Replace placeholders, empty objects, arrays, and zero values with valid account-specific inputs. Read required fields and nested constraints in the full schema. Confirm the account, connected channels, and referenced assets before calling a write tool.

curl
curl -s -X POST https://mcp-server.metadata.io/mcp \
  -H "Authorization: $METADATA_PAT" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "MCP-Protocol-Version: 2025-11-25" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"set_campaign_utms","arguments":{"campaign_id":0,"channel":"LINKEDIN","utms":{}}}}'

Response

No recorded response. This tool can delete, archive, launch or move budget, so it is never executed to build these docs. The request is an illustrative template. Fill required fields and check the current schema before calling it. No response is fabricated.

Other campaigns tools:

Browse the tool catalog · machine-readable index