TL;DR
We shipped a tracking integrity agent that audits campaign links end to end, repairs UTM parameters, and opens safe fixes across content repos and ad platforms. In the first month it found 3,742 issues and automatically corrected 61 percent without human review. The remaining changes landed through pull requests and a canary rollout. The outcome was fewer dead clicks, cleaner reports, and one mention of workflow automation where it belongs.
The bug that started it
One Tuesday a partner campaign launched with a gorgeous landing page and a memorable vanity URL. By noon, our analytics showed a spike of direct sessions with no campaign information. The first suspicion was bots. The second was a misconfigured redirect. It turned out to be simpler. The marketing file that generated short links had dropped query parameters during a copy paste. Hundreds of paid clicks were landing cleanly but without attribution.
This was not our first tracking mishap, but it was the most visible. We wanted a repeatable, agentic workflow that could audit links before a campaign flew and continue to watch production for regressions. We also wanted fixes to be safe by default. Opening a spreadsheet and shouting in chat was not an option anymore.
Goals and non goals
- Catch broken links, infinite redirects, and soft 404s for every campaign asset.
- Normalize UTM parameters to a contract per channel and per brand.
- Propose minimal diffs that preserve existing logic and partner parameters.
- Apply reversible fixes through pull requests or templated rewrites.
- Integrate with OpenClaw scheduling and ButterGrow approvals to avoid bespoke infrastructure.
Non goals included building a new analytics tool or replacing link shorteners. We scoped narrowly to detect and repair what broke attribution and to document every decision like a change control log.
Architecture overview
At a high level the system is three loops. A discovery loop inventories URLs across ads, emails, and site menus. A validation loop crawls destinations and evaluates redirects, status codes, and canonical tags. A remediation loop proposes or applies fixes, then watches for regressions. We implemented all three as OpenClaw playbooks, each with clear contracts.
The first time this runs in a repository it opens a report alongside a summary comment that links to the relevant ButterGrow artifacts. The artifacts keep diffs, screenshots, and traces. That gives stakeholders a single source of truth and reduces back and forth.
Step 1Map the inventory of links
We built specialized collectors for each channel. For paid ads we call platform APIs to pull final URLs and tracking templates. For email we parse templates and resolve variables into preview links. For the website we traverse the sitemap and static navs. We also maintain a small list of vanity domains used in QR codes and print.
The output is a uniform list of candidate URLs with channel context. We store that list per commit and per campaign so that diffs are obvious. When a change lands, the agent knows exactly which links to recheck.
Step 2Crawl and validate final destinations
The crawler respects robots, sets a realistic user agent, and follows up to five redirects. It records status codes, timings, titles, canonical links, and whether the final page loads required assets. For every hop it logs which query parameters are preserved and which are dropped. That history is what powers our normalization suggestions.
We also built a small set of detectors. A soft 404 detector classifies pages that return 200 but show error content. A UTM stripper detector flags any intermediate hop that drops parameters. A canonical mismatch detector tells us when the final landing page is not the expected product URL.
Step 3Parse and normalize parameters
Instead of hard coding rules, we wrote a small policy schema that defines which parameters must exist and how to format values. The schema is friendly to non engineers and lives in a repository. Here is the simplified version we use for most web channels.
{
"channel": "web",
"required": ["utm_source", "utm_medium", "utm_campaign"],
"optional": ["utm_content", "utm_term"],
"normalizers": {
"utm_source": "lowercase",
"utm_medium": {
"type": "enum",
"values": ["email", "paid", "social", "referral"]
},
"utm_campaign": {
"type": "pattern",
"regex": "^[a-z0-9-]{3,64}$"
}
},
"preserveUnknown": true
}
The agent applies the schema to each URL, suggests minimal changes, and records whether the adjustment is safe to apply automatically. For example, converting an uppercase source to lowercase is safe. Inserting a missing campaign value is not. That distinction keeps automation honest.
Step 4Suggest and apply fixes
We support two remediation paths. The first is write through via a templating layer. The agent rewrites tracking templates at render time using a small transformer that runs after variables resolve. This works best for email and CMS pages. The second is pull request mode for static assets and ad accounts. In PR mode the agent commits a one line change per link and adds a short rationale.
To avoid surprises we compare three options side by side during planning.
| Path | Change scope | Risk profile | Typical channels |
|---|---|---|---|
| Template transformer | Runtime only | Low if feature flagged | Email, CMS pages |
| Pull request | Source files | Medium with review | Static pages, docs |
| Ad platform edit | External system | Medium due to approvals | Paid search, paid social |
The choice depends on the owner and the blast radius. We default to transformers behind feature flags for fast feedback. If a template has no safe hook, we open a PR so that people can review the exact diff.
Step 5Roll out with guardrails
We borrowed ideas from previous projects to get deployment right. Each change runs behind a feature flag with a canary percentage and a timed rollback. We also log every rewrite into an audit trail so that marketing can see what changed. The rollback timer defaults to 30 minutes. If no anomalies are detected in that window, the flag rolls forward to 100 percent.
Guardrails also include SLOs. The agent must complete a full crawl in under 15 minutes and keep a false positive rate under 2 percent. If either SLO breaks, the runtime degrades to suggest only and pauses auto apply.
Results after eight weeks
We rolled this out gradually. Week one was read only on two sites and three email programs. Week two added paid search and social. By week four we covered the entire content surface. The results held across seasonal changes and a site redesign.
- 3,742 issues detected, 2,290 auto fixed, 1,452 PR based fixes.
- Click to session conversion improved by 3.4 percent overall.
- Campaign attribution rate increased from 84 to 92 percent.
- Broken link rate dropped from 1.9 to 0.4 percent.
The numbers are not magical, they are the result of consistent enforcement and small safe changes. The best part was trust. The team stopped wondering whether a link was safe to ship. The agent made the answer obvious.
Where OpenClaw and ButterGrow fit
We implemented discovery, validation, and remediation as OpenClaw playbooks and scheduled them like any other job. That gave us variables, secrets, and a simple way to compose steps. We also leaned on ButterGrow for the workflow that humans see. The audit log preserves every change and the approvals flow is integrated into the same place people already use for content.
If you want to understand the product surface, the page that summarizes the AI marketing automation features is a good starting point. It also links to examples that look a lot like this agent. As questions come up, the page with answers to common questions is the fastest way to confirm how flags, logs, and approvals work.
For a deeper view of attribution on the server side, the server side UTM attribution guide walks through capturing parameters before frontend scripts run. It pairs nicely with the agent in this article because it removes a separate source of drop off.
Implementation notes and tradeoffs
The validator should not be a browser
We debated running a headless browser for every page. The crawler would have detected more layout issues and script errors. We decided against it for cost and complexity. A simple HTTP client with retries and a short asset probe was enough to catch the problems that ruin attribution. We left a hook so that a headless pass can be enabled for critical pages.
Normalization is a contract and a conversation
The agent does not invent parameters. It enforces the contract that marketing signs off on. That means the first pull request is as much a policy document as it is a code change. Once people see that normalization lowers noise in reports, they volunteer improvements. The schema lives with content because that is where the knowledge is.
Agent analytics matters
We instrumented the agent so that we could see false positives by channel, time to auto fix, and rollback frequency. Those metrics did two things. They kept us honest about over automation and they highlighted where owners needed context. If this interests you, our write up on instrumenting agent analytics shows how to log, monitor, and debug agents with minimal overhead.
The smallest fix beats the biggest redesign
There is a temptation to rebuild the entire link layer. That would have made ownership worse and delayed benefits. Instead we hooked into existing render paths, added a small transformer, and wrote clear pull requests. People merged them quickly because they were scoped and reversible.
Long tail questions the agent had to answer
Support and sales asked for search phrases to find in our docs. We optimized for queries like how to audit UTM parameters at scale, how to fix broken campaign links automatically, and how to roll out tracking normalization without downtime. Those phrases drove the structure of this post and the schema in the repository.
What we would change next
- Expand channel contracts to cover app links and QR workflows.
- Add partner specific normalizers for networks with quirky rules.
- Build a lightweight UI on top of the audit log so that non engineers can approve batches directly.
- Introduce sandbox ads to test tracking before launch windows.
We will also revisit policies for vanity URLs and deep links. Those areas were less consistent across brands and partners. A structured contract will help.
The last lesson is that agentic workflow is not a slogan. It is a small loop that runs every day and makes fewer mistakes than we do. When it finds a mistake it explains the fix, applies it safely, and writes down what changed so the next person can see why.
ButterGrow is the hosted OpenClaw assistant that made this project practical. If you want the same outcome, read through ButterGrow to see the feature set, then try the onboarding flow to get started in minutes.
References
- GA4 campaign parameters documentation: official guidance on how GA4 interprets UTM keys and values.
- RFC 3986 URI syntax: canonical reference for query strings, encoding, and path semantics.
- Moz guide to URL parameters: practical overview of parameter handling and SEO side effects.
Frequently Asked Questions
How does the agent detect missing or malformed UTM parameters without inflating false positives?+
We run a crawl that resolves final URLs, then apply a contract that whitelists allowed parameter shapes per channel. Only if required keys like utm_source and utm_campaign are absent or mapped to disallowed values do we flag an issue. A learned allowlist prevents flagging legitimate partner parameters.
What is the safest way to apply auto fixes across thousands of links?+
We use a two stage path. In read only we suggest normalization diffs and open pull requests in content repos. In write through we flip a feature flag that rewrites tracking templates at render time. Both paths gate changes behind canary percentages and rollback timers.
How do you keep attribution intact when links redirect multiple times before landing on a page?+
The crawler follows up to five redirects and preserves query parameters during testing. If a hop strips parameters, we either rewrite the intermediate destination to include tracking or switch to a deep link that lands directly on the canonical page.
Which metrics proved the agent was worth running beyond the first week?+
We tracked click to session conversion, campaign attribution rate, and broken link rate. After rollout, click to session improved by 3.4 percent and broken link rate dropped from 1.9 to 0.4 percent. Those deltas persisted over eight weeks with seasonal adjustments.
How does this integrate with OpenClaw and ButterGrow without duplicating features?+
We run the crawler and policy engine as OpenClaw playbooks and store diffs in ButterGrow run artifacts. ButterGrow handles scheduling, audit logs, and approvals so we avoid bespoke cron and spreadsheets.
What long tail queries did we design the agent to answer for support teams?+
We cover how to audit UTM parameters at scale, how to fix broken campaign links automatically, and how to roll out tracking normalization without downtime. These phrases also power internal playbook search.
Ready to try ButterGrow?
See how ButterGrow can supercharge your growth with a quick demo.
Book a Demo