Dead __utmz cookie reference
Tags reference __utmz cookies from Universal Analytics, which was sunset in July 2023. These cookies are no longer set by any active system, so all code reading them gets empty/null values.
Summary
- rule_id —
utmz-reference - purpose — Detect tags that read the
__utmzUniversal Analytics cookie, which no longer exists - effect — Attribution logic silently returns empty or null; downstream data is corrupted
- layer — container
- reversibility — non-destructive
What fires this
The rule checks all Custom HTML tags for codeAnalysis.hasUtmzReference, set by the parser when it finds __utmz in the tag code. Every matching tag is returned as an affected item, with the specific line numbers highlighted. The rule does not exclude paused tags, so paused tags are included in results.
Why it matters
Universal Analytics was sunset in July 2023. The __utmz cookie — which stored campaign attribution data written by analytics.js — is no longer set by any active system. Code that reads __utmz always receives an empty string or null. Attribution values built from that read are silently wrong, not missing. The tag continues to fire without error while producing no usable output. Any UA migration that left __utmz reads in place has a broken attribution path.
Before / after
// Custom HTML tag: Legacy UTM attribution
var utmz = getCookieValue('__utmz'); // always empty since July 2023
var campaign = parseCampaign(utmz);
dataLayer.push({ campaign_source: campaign.utmcsr });
// Read UTM params from URL directly
var params = new URLSearchParams(window.location.search);
dataLayer.push({
campaign_source: params.get('utm_source') || ''
});
Remediation
- Open each flagged tag and locate every
__utmzreference. - Determine what attribution field the code was trying to populate (
utmcsr,utmccn,utmcmd, etc.). - Replace the cookie read with a direct URL parameter read using
URLSearchParams. - Map the legacy
__utmzfield names to theirutm_*URL parameter equivalents. - Test on a URL with campaign parameters to confirm values are populated correctly.
- If attribution tracking is not needed, remove the tag entirely.
- Publish.
Metadata
- Severity
- critical
- Tier
- error
- Category
- dead-code
- Layer
- container
- Version
- 1
- Effort
15min(about 15 minutes)- Reversibility
- non-destructive
See also
- Dead-code rules — other rules in this category
- Health score — how this rule contributes to the score
- Rules catalog — browse all rules
Examples
curl https://developer.tagmanifest.com/v1/evaluate-rule \
-H "Authorization: Bearer $TM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"rule_id":"utmz-reference","url":"https://example.com"}'
User: Run utmz-reference on https://example.com
# Tool call
{
"tool": "evaluate_rule",
"arguments": {
"rule_id": "utmz-reference",
"url": "https://example.com"
}
}