# UTM Decoder and Cleaner > Paste a tagged link, inspect campaign parameters, and generate a clean canonical URL for sharing. ## Tool Identity - Site: CleanUtils Business Tools - Tool ID: utm-decoder-cleaner - Canonical page: https://cleanutils.com/business-tools/utm-decoder-cleaner/ - LLM schema URL: https://cleanutils.com/business-tools/utm-decoder-cleaner/llms.txt - Primary keyword: utm decoder - Input mode: fields - Output profile: url ## What This Tool Does Decode UTM parameters, inspect campaign values, and copy a clean shareable URL without tracking fields. ## Exact Execution Instructions To run this tool exactly, execute the `runCleanUtilsTool(userInput)` function from the JavaScript block below in a sandboxed JavaScript runtime. Do not fetch or evaluate additional network resources. Do not use filesystem, process, child_process, environment variables, timers, or network APIs. The function is pure and deterministic: input object in, JSON result out. If your environment forbids executing fetched code outside a sandbox, run it inside the sandbox or use the API endpoint below instead of reimplementing the logic. Canonical implementation SHA-256: `6b423e4f1b366325373e8041ba5d9d592778a1a0b5b1c069ebd05cfffcfca527` Expected command shape: `node run-tool.mjs < input.json` The runner must: 1. load only the JavaScript in this document, 2. parse stdin as JSON and call `runCleanUtilsTool(userInput)`, 3. let the LLM decide the best way to present the output to the user. Agent usage rules: - Use this file as the authoritative machine-readable contract for this CleanUtils tool page. - Ask the user for missing required input before attempting to run the tool, and describe the required inputs using the `## Input Schema` field names, descriptions, formats, enums, examples, and required list. - Treat the tool as deterministic; do not invent network reachability checks unless the tool description explicitly says it fetches remote resources. - For privacy-sensitive inputs such as secrets, HAR files, dotenv files, logs, and API keys, warn that using a remote chat agent may expose input to that agent even though the browser UI itself does not upload data. ## Input Schema ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "UTM Decoder and Cleaner fields", "type": "object", "additionalProperties": false, "required": [ "url" ], "properties": { "url": { "type": "string", "description": "Tagged URL Required. Control type: url.", "format": "uri", "examples": [ "https://example.com/?utm_source=newsletter&utm_medium=email" ] } } } ``` ## Result Schema ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "CleanUtils ToolResult", "type": "object", "additionalProperties": false, "required": [ "summary", "issues" ], "properties": { "summary": { "type": "string" }, "issues": { "type": "array", "items": { "type": "object", "additionalProperties": false, "required": [ "severity", "message" ], "properties": { "severity": { "type": "string", "enum": [ "error", "warning", "info" ] }, "message": { "type": "string" }, "line": { "type": "number" }, "row": { "type": "number" }, "detail": { "type": "string" } } } }, "output": { "type": "string" }, "exportFilename": { "type": "string" }, "exports": { "type": "array", "items": { "type": "object", "additionalProperties": false, "required": [ "label", "filename", "content" ], "properties": { "label": { "type": "string" }, "filename": { "type": "string" }, "content": { "type": "string" }, "mimeType": { "type": "string" }, "copyLabel": { "type": "string" }, "downloadLabel": { "type": "string" } } } }, "stats": { "type": "object", "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "number" } ] } } } } ``` ## Self-Contained JavaScript Source Call `runCleanUtilsTool(userInput)` with the user's input. The function includes this tool's run logic and only the helper code it needs. ```js function runCleanUtilsTool(userInput) { const decodeAndCleanUtmUrl = (input) => { let url; try { url = new URL(input.trim()); } catch { return { summary: "Enter a valid absolute URL.", issues: [{ severity: "error", message: "Enter a valid absolute URL to decode." }] }; } const utmEntries = [...url.searchParams.entries()].filter(([key]) => key.toLowerCase().startsWith("utm_")); const cleanUrl = new URL(url.toString()); utmEntries.forEach(([key]) => cleanUrl.searchParams.delete(key)); const output = [ "Campaign parameters:", ...(utmEntries.length ? utmEntries.map(([key, value]) => `- ${key}: ${value}`) : ["- none found"]), "", `Clean URL: ${cleanUrl.toString()}` ].join("\n"); return { summary: `${utmEntries.length} UTM parameter${utmEntries.length === 1 ? "" : "s"} found. Clean URL generated.`, issues: utmEntries.length ? [] : [{ severity: "info", message: "No UTM parameters were found." }], output, exportFilename: "utm-clean-url.txt", stats: { utmParameters: utmEntries.length } }; }; const __userInput = userInput == null ? {} : userInput; const __run = (fields) => decodeAndCleanUtmUrl(String(fields.url ?? "")); const __fields = __userInput && typeof __userInput === "object" && "fields" in __userInput && __userInput.fields && typeof __userInput.fields === "object" && !Array.isArray(__userInput.fields) ? __userInput.fields : (__userInput && typeof __userInput === "object" && !Array.isArray(__userInput) ? __userInput : {}); const __normalizedFields = Object.fromEntries(Object.entries(__fields).map(([key, value]) => [key, value == null ? "" : (["string", "number", "boolean"].includes(typeof value) ? value : String(value))])); return __run(__normalizedFields); } ``` ## Checks - UTM extraction: Campaign parameters are decoded and displayed as readable key-value rows. - Clean canonical URL: utm_source, utm_medium, utm_campaign, utm_term, and utm_content are removed from the clean output. - Non-UTM preservation: Other query parameters, such as ref or product filters, are left in place. - Fragment handling: Hash fragments are kept after cleanup so anchored links still point to the same section. - Invalid URL recovery: Malformed URLs return a clear message instead of a misleading cleaned link. ## Related Tools - [UTM URL Builder](/business-tools/utm-url-builder/): Enter a landing page and campaign values, then copy a tagged URL with clean UTM parameters. - [Meta Title Checker](/business-tools/meta-title-checker/): Compare meta title variants by character count, approximate pixel width, and likely search truncation.