UTM Builder API
Add UTM campaign parameters to a URL (replacing any existing ones, keeping other parameters and the #fragment), or parse the UTM parameters out of a tagged URL.
POST /api/v1/tools/utm-builderMCP utm_builderWeb & SEOBuild campaign URLs with utm_source, utm_medium, utm_campaign and more. Keeps existing parameters and #fragments, warns about case and spaces, and parses UTM links.
Input
Send these as a JSON object. Unknown fields are rejected.
- url
- The landing page URL, or in parse mode a URL with UTM parameters. (string, up to 4096 characters, required)
- mode
- build: add the utm_* fields to url. parse: split url into its UTM and other parameters. (string, one of build, parse, default "build")
- utm_source
- build: where the traffic comes from, e.g. newsletter or google. Required in build mode. (string, up to 500 characters)
- utm_medium
- build: marketing medium, e.g. email, cpc or social. (string, up to 500 characters)
- utm_campaign
- build: campaign name, e.g. spring_sale. (string, up to 500 characters)
- utm_term
- build: paid search keyword. (string, up to 500 characters)
- utm_content
- build: distinguishes ads or links in the same campaign, e.g. header_button. (string, up to 500 characters)
- utm_id
- build: campaign ID. (string, up to 500 characters)
curl https://pithlab.com/api/v1/tools/utm-builder \n -H "Authorization: Bearer $PITHLAB_KEY" \n -H "Content-Type: application/json" \n -d '{"url":"https://shop.example.com/sale?ref=home#top","utm_source":"newsletter","utm_medium":"email","utm_campaign":"spring_sale"}'Example response
{
"ok": true,
"result": {
"url": "https://shop.example.com/sale?ref=home&utm_source=newsletter&utm_medium=email&utm_campaign=spring_sale#top",
"warnings": []
}
}