set_utm_params
Add UTM tracking parameters to QR code URLs to monitor scan analytics in tools like Google Analytics, or remove parameters when needed.
Instructions
Set UTM tracking parameters on a URL QR code. These parameters are automatically appended to the target URL on every scan redirect. Use this to track QR code scans in Google Analytics or other analytics tools. Set 'clear' to true to remove all UTM parameters.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| short_id | Yes | The short ID of the QR code (must be type='url'). | |
| source | No | utm_source value (e.g. 'flyer', 'email', 'poster'). | |
| medium | No | utm_medium value (e.g. 'print', 'qr', 'social'). | |
| campaign | No | utm_campaign value (e.g. 'summer_2026'). | |
| term | No | utm_term value (paid search keyword). | |
| content | No | utm_content value (A/B test variant). | |
| clear | No | Set to true to remove all UTM parameters from this QR code. |
Implementation Reference
- packages/mcp/src/tools.ts:755-769 (handler)The handler function for set_utm_params, which constructs the update body and makes the API PATCH request.
handler: async (input: { short_id: string; source?: string; medium?: string; campaign?: string; term?: string; content?: string; clear?: boolean }) => { const body: Record<string, unknown> = {}; if (input.clear) { body.utm_params = null; } else { const utm: Record<string, string> = {}; if (input.source) utm.source = input.source; if (input.medium) utm.medium = input.medium; if (input.campaign) utm.campaign = input.campaign; if (input.term) utm.term = input.term; if (input.content) utm.content = input.content; body.utm_params = utm; } return apiRequest(`/api/qr/${input.short_id}`, { method: "PATCH", body }); }, - packages/mcp/src/tools.ts:746-754 (schema)The inputSchema definition for set_utm_params using Zod.
inputSchema: z.object({ short_id: z.string().describe("The short ID of the QR code (must be type='url')."), source: z.string().optional().describe("utm_source value (e.g. 'flyer', 'email', 'poster')."), medium: z.string().optional().describe("utm_medium value (e.g. 'print', 'qr', 'social')."), campaign: z.string().optional().describe("utm_campaign value (e.g. 'summer_2026')."), term: z.string().optional().describe("utm_term value (paid search keyword)."), content: z.string().optional().describe("utm_content value (A/B test variant)."), clear: z.boolean().optional().describe("Set to true to remove all UTM parameters from this QR code."), }), - packages/mcp/src/tools.ts:743-770 (registration)The registration of the set_utm_params tool in the tools object.
set_utm_params: { description: "Set UTM tracking parameters on a URL QR code. These parameters are automatically appended to the target URL on every scan redirect. Use this to track QR code scans in Google Analytics or other analytics tools. Set 'clear' to true to remove all UTM parameters.", inputSchema: z.object({ short_id: z.string().describe("The short ID of the QR code (must be type='url')."), source: z.string().optional().describe("utm_source value (e.g. 'flyer', 'email', 'poster')."), medium: z.string().optional().describe("utm_medium value (e.g. 'print', 'qr', 'social')."), campaign: z.string().optional().describe("utm_campaign value (e.g. 'summer_2026')."), term: z.string().optional().describe("utm_term value (paid search keyword)."), content: z.string().optional().describe("utm_content value (A/B test variant)."), clear: z.boolean().optional().describe("Set to true to remove all UTM parameters from this QR code."), }), handler: async (input: { short_id: string; source?: string; medium?: string; campaign?: string; term?: string; content?: string; clear?: boolean }) => { const body: Record<string, unknown> = {}; if (input.clear) { body.utm_params = null; } else { const utm: Record<string, string> = {}; if (input.source) utm.source = input.source; if (input.medium) utm.medium = input.medium; if (input.campaign) utm.campaign = input.campaign; if (input.term) utm.term = input.term; if (input.content) utm.content = input.content; body.utm_params = utm; } return apiRequest(`/api/qr/${input.short_id}`, { method: "PATCH", body }); }, },