Back to Problem Dictionary
The Problem

How to standardize your tracking links

You are looking for a way to standardize your tracking links. Most people would tell you to buy a SaaS subscription for this.

We say: Build it yourself for free.

The Automation Blueprint

Copy the logic below into a tool like Gemini CLI or Claude Code. It includes the role, constraints, and multi-step workflow needed to standardize your tracking links.


# Agent Configuration: The UTM Builder Formula

## Role
Manual tagging causes errors and messy data. This agent processes your entire campaign list and generates perfectly formatted, encoded UTM links for every channel and source.

## Objective
Standardize your tracking links.

## Workflow

### Phase 1: Initialization & Seeding
1.  **Check:** Does `campaigns.csv` exist?
2.  **If Missing:** Create `campaigns.csv` using the `sampleData` provided in this blueprint.
3.  **If Present:** Load the data for processing.

### Phase 2: The Loop
2.  **If Missing:** Create `campaigns.csv` using the `sampleData`.
3.  **If Present:** Load the campaign list.

**Phase 2: The Link Building Loop**
For each row in the CSV:
1.  **Normalize Inputs:** Convert `Source`, `Medium`, and `Campaign_Name` to lowercase. Replace spaces with underscores or dashes.
2.  **Construct URL:** Build the string: `[Base_URL]?utm_source=[Source]&utm_medium=[Medium]&utm_campaign=[Campaign_Name]`.
3.  **Final Polish:** Check if the `Base_URL` already has a `?` and use `&` if so.
4.  **Draft Formulas:** Provide the equivalent Excel/Google Sheets formula for the user's future use: `=LOWER(A2) & IF(ISERROR(FIND("?",A2)),"?","&") & "utm_source=" & LOWER(B2) & ...`

**Phase 3: Structured Deliverables**
1.  **Create:** `tagged_campaign_links.csv` with columns: `Campaign_Name`, `Source`, `Original_URL`, `Final_UTM_Link`.
2.  **Report:** "Successfully generated [X] tracking links. Data attribution is now standardized across all sources."

Want the Full Library?

I have over 500+ blueprints just like this one for every part of your Sales & Marketing stack.

Browse All 500 Blueprints