What This Rule Detects
Detects double URL encoding where values are encoded multiple times. For example, a space character becomes %20 (single encoding), but when encoded again becomes %2520 (double encoding). When GA4 decodes this ONCE, it shows %20 as literal text instead of a space, causing campaign names to appear with encoded characters instead of readable text.
🔍 Want to scan for this issue automatically?
UTMGuard checks for this and 39 other validation rules in 60 seconds.
Try Free AuditWhy It Matters
Business Impact:
- Unreadable campaign names - Reports show "%20" instead of spaces
- Data fragmentation - "summer%20sale" vs "summer sale" appear as different campaigns
- Reporting confusion - Teams cannot understand campaign names
- Client presentation issues - Reports look unprofessional with encoded text
- Time waste - Manual cleanup required for reports
Technical Impact:
- URLs are encoded when built, then encoded AGAIN during transmission
- First decode reveals encoded characters, not original text
- GA4 stores the partially-decoded, still-encoded value
- Reports display URL encoding artifacts (%20, %2C, %26) as literal text
- Makes data matching and consolidation difficult
- Requires regex patterns to clean data
Real Example:
- Original text: "summer sale"
- Single encoding:
summer%20sale(space → %20) - Double encoding:
summer%2520sale(%20 → %2520) - GA4 decodes once: Campaign name = "summer%20sale" (literal %20 shown!)
- Your report shows: "summer%20sale" instead of "summer sale"
- Impact: Campaign name unreadable, appears technical and broken
Common Scenarios
Scenario 1: URL Builder + Email ESP Double Encoding
URL already encoded gets encoded again by email platform:
Scenario 2: Automated System Re-Encoding
Marketing automation tool encoding already-encoded values:
Scenario 3: API Response Double Encoding
API returns encoded URL, application encodes it again:
😰 Is this your only tracking issue?
This is just 1 of 40+ ways UTM tracking breaks. Most marketing teams have 8-12 critical issues they don't know about.
• 94% of sites have UTM errors
• Average: $8,400/month in wasted ad spend
• Fix time: 15 minutes with our report
✓ Connects directly to GA4 (read-only, secure)
✓ Scans 90 days of data in 2 minutes
✓ Prioritizes issues by revenue impact
✓ Shows exact sessions affected
How to Fix
Step 1: Understand How Double Encoding Happens
The double encoding process:
Original: "summer sale"
Step 1 - First encoding (correct):
- space → %20
- Result: "summer%20sale"
Step 2 - Second encoding (ERROR):
- % → %25
- 2 → 2 (not encoded)
- 0 → 0 (not encoded)
- Result: "summer%2520sale"
When GA4 decodes ONCE:
- %25 → %
- 20 → 20 (unchanged)
- Result displayed: "summer%20sale" (literal text!)
Common double-encoding patterns:
Space:
- Single: %20 → displays as space ✅
- Double: %2520 → displays as "%20" ❌
Slash:
- Single: %2F → displays as / ✅
- Double: %252F → displays as "%2F" ❌
Ampersand:
- Single: %26 → displays as & ✅
- Double: %2526 → displays as "%26" ❌
Step 2: Identify Double Encoding
Detection patterns:
Look for %25 followed by another hex code:
❌ %2520 = Double-encoded space (should be %20)
❌ %252F = Double-encoded slash (should be %2F)
❌ %2526 = Double-encoded ampersand (should be %26)
❌ %253D = Double-encoded equals (should be %3D)
❌ %253F = Double-encoded question mark (should be %3F)
Pattern recognition:
%25 = Encoded % sign
If you see %25 followed by hex digits, it's likely double-encoded
Examples:
- %2520: "25" is hex for %, "20" is hex for space → Double encoded
- %252F: "25" is hex for %, "2F" is hex for / → Double encoded
- %2526: "25" is hex for %, "26" is hex for & → Double encoded
Step 3: Prevent Double Encoding
Strategy A: Use Plain Text (RECOMMENDED)
Why recommended:
- Eliminates all encoding issues
- Human-readable URLs
- No encoding/decoding confusion
- Works universally
- Easy to maintain
Implementation:
✅ Replace spaces with hyphens: "summer sale" → "summer-sale"
✅ Remove special characters: "A&B" → "a-and-b"
✅ Use only alphanumeric + hyphens: Simple and safe
✅ Let browsers handle the rest
Result: No encoding needed, no double encoding possible
Strategy B: Decode Before Re-Encoding
When to use:
- Receiving URLs from external systems
- Integrating with APIs
- Processing user input
Implementation:
// Wrong: Encoding already-encoded URL
const url = "example.com?utm_campaign=summer%20sale";
const encoded = encodeURIComponent(url); // Results in double encoding!
// Right: Decode first, then encode if needed
const url = "example.com?utm_campaign=summer%20sale";
const decoded = decodeURIComponent(url); // "summer sale"
const reencoded = encodeURIComponent(decoded); // "summer%20sale" (correct)Strategy C: Check for Existing Encoding
Implementation:
function safeEncode(value) {
// Check if already encoded
if (value !== decodeURIComponent(value)) {
// Already encoded, return as-is
return value;
}
// Not encoded, encode now
return encodeURIComponent(value);
}
// Usage:
safeEncode("summer sale") // Returns: "summer%20sale"
safeEncode("summer%20sale") // Returns: "summer%20sale" (not double-encoded!)Step 4: Fix Existing Double-Encoded URLs
Manual fix process:
1. Identify double encoding:
Search for: %25
In URL parameters, this often indicates double encoding
2. Decode once:
Input: "summer%2520sale"
Decode: "summer%20sale"
Result: Still shows %20 as text
Better: Replace with hyphens entirely
Final: "summer-sale"
3. Update URL sources:
Email templates: Fix campaign URL fields
Ad platforms: Update destination URLs
Marketing automation: Fix URL generation logic
API integrations: Add decoding step before encoding
Programmatic fix:
// Decode until no more encoding detected
function fullyDecode(value) {
let decoded = value;
let previous = '';
while (decoded !== previous) {
previous = decoded;
decoded = decodeURIComponent(decoded);
}
return decoded;
}
// Then use plain text or encode once
const original = "summer%2520sale";
const decoded = fullyDecode(original); // "summer sale"
const final = decoded.replace(/ /g, '-'); // "summer-sale"Step 5: Fix Root Causes
Common sources of double encoding:
1. URL builder + Platform encoding:
Problem: URL builder encodes, then email ESP encodes again
Solution: Use plain text in URL builder, let platform handle encoding OR
disable automatic encoding in platform settings
2. Template concatenation:
Problem: Merging encoded URL parts
Solution: Decode all parts, merge, then encode once
3. API response processing:
Problem: API returns encoded URL, code encodes again
Solution: Check if response is already encoded before processing
4. Form submission handling:
Problem: Browser encodes form data, server-side script encodes again
Solution: Use raw form values, don't re-encode
Examples
❌ Incorrect Examples
https://example.com?utm_campaign=summer%2520sale&utm_medium=email
Double-encoded: %2520
GA4 displays: utm_campaign = "summer%20sale" (literal %20)
Result: Campaign name shows URL encoding in reports
Impact: Unprofessional reports, data fragmentation
https://shop.com?utm_content=banner%252Fv2&utm_campaign=spring
Double-encoded: %252F
GA4 displays: utm_content = "banner%2Fv2" (literal %2F)
Result: Content tag unreadable, shows encoding artifacts
Impact: A/B testing broken, cannot identify variations
https://example.com?utm_source=partner%2526co&utm_medium=referral
Double-encoded: %2526
GA4 displays: utm_source = "partner%26co" (literal %26)
Result: Source name shows encoding instead of &
Impact: Partner attribution looks technical and broken
✅ Correct Examples
https://example.com?utm_campaign=summer-sale&utm_medium=email
No encoding needed: Hyphens instead of spaces
GA4 displays: utm_campaign = "summer-sale"
Result: Clean, readable campaign name
Tracking: SUCCESS (professional reports)
https://shop.com?utm_content=banner-v2&utm_campaign=spring
No special characters: Simple alphanumeric + hyphens
GA4 displays: utm_content = "banner-v2"
Result: Clear content variation labels
Tracking: SUCCESS (clean A/B test data)
https://example.com?utm_source=partner-co&utm_medium=referral
Hyphenated: No special characters needed
GA4 displays: utm_source = "partner-co"
Result: Professional, readable source name
Tracking: SUCCESS (clear partner attribution)
GA4 Impact Analysis
Report Display:
- Campaign names show with encoding artifacts
- "summer%20sale" instead of "summer sale"
- "product%2Flaunch" instead of "product/launch"
- Makes reports look broken and unprofessional
Data Fragmentation:
- "summer sale" (correct) vs "summer%20sale" (double-encoded) appear as 2 campaigns
- Same campaign split across multiple entries
- Cannot consolidate metrics
- ROI calculation unreliable
Client/Stakeholder Confusion:
- Non-technical users don't understand encoded characters
- Reports require explanation
- Loss of confidence in data quality
- Time wasted explaining encoding issues
Data Matching:
- Automated data matching fails
- "summer%20sale" doesn't match "summer sale" in joins
- Cross-platform attribution broken
- Manual cleanup required
Search and Filter:
- Cannot search for "summer sale" if stored as "summer%20sale"
- Report filters don't work intuitively
- Regex patterns required for simple queries
- User experience degraded
Detection in UTMGuard
UTMGuard automatically detects double encoding:
- Scans all page URLs in your GA4 data
- Identifies %25 patterns followed by hex digits
- Flags double-encoded parameter values
- Decodes to show original intended value
- Reports affected campaigns and sessions
- Suggests clean alternatives (hyphens, plain text)
Audit Report Shows:
- Total sessions with double-encoded parameters
- List of double-encoded values
- What the value should be (decoded)
- Recommended fix (hyphenated plain text)
- Session count per double-encoded pattern
Related Validation Rules
Related Validation Rules
Frequently Asked Questions
Q: How can I tell if encoding is doubled?
A: Look for %25 followed by hex digits. Examples: %2520 (double-encoded space), %252F (double-encoded slash). If you see %25 in parameter values, it's likely double-encoded.
Q: Can GA4 automatically fix double encoding?
A: No. GA4 decodes once and stores the result. If the result still contains encoding (%20, %2F, etc.), that's what appears in reports. Prevention is the only solution.
Q: Will this affect my historical data?
A: Yes, historical data showing encoded characters cannot be retroactively fixed. The fix only prevents future occurrences. You may need to manually consolidate historical reports.
Q: What causes double encoding?
A: Usually system integration issues: URL builder encodes, then email platform encodes again. Or API returns encoded URLs that get re-encoded. Or template concatenation of already-encoded parts.
Q: Should I decode and re-encode to fix?
A: Better to use plain text (hyphens instead of spaces) to avoid encoding entirely. If you must encode, decode existing encoding first, then encode once.
Q: How do I prevent this in automated systems?
A: Check if value is already encoded before encoding. Use functions like JavaScript's decodeURIComponent() first, or implement a "safe encode" function that detects existing encoding.
Q: Can URL shorteners fix this?
A: No. Shorteners preserve the destination URL. If the destination is double-encoded, the problem persists when users click through.
Q: What if my ESP automatically encodes all URLs?
A: Use plain text values (hyphens, no spaces) so encoding has no effect. Or check ESP settings to disable automatic encoding if you're handling it in your URL builder.
External Resources
- RFC 3986: Percent Encoding
- MDN: encodeURIComponent()
- W3C: URL Encoding Best Practices
- Google Campaign URL Builder
✅ Fixed this issue? Great! Now check the other 39...
You just fixed one tracking issue. But are your Google Ads doubling sessions? Is Facebook attribution broken? Are internal links overwriting campaigns?
• Connects to GA4 (read-only, OAuth secured)
• Scans 90 days of traffic in 2 minutes
• Prioritizes by revenue impact
• Free forever for monthly audits
Join 2,847 marketers fixing their tracking daily
double_url_encoding