Fix Multiple Question Marks in URL: 30-Second Solution

UTMGuard Team
5 min readtroubleshooting

Your URL has two question marks. Parameter parsing is broken. GA4 shows corrupted data.

Here's the 30-second fix.

🚨 Not sure what's breaking your tracking?

Run a free 60-second audit to check all 40+ ways UTM tracking can fail.

Scan Your Campaigns Free

✓ No credit card ✓ See results instantly

The Problem

❌ BROKEN:
site.com?page=1?utm_source=facebook&utm_medium=cpc
           ↑    ↑
        First  Second (ERROR!)

Only ONE ? allowed per URL.

The Fix

Step 1: Find the Second ? (10 seconds)

site.com?page=1?utm_source=facebook
           ↑    ↑
        Keep  Change to &

Step 2: Replace with & (10 seconds)

❌ BEFORE:
site.com?page=1?utm_source=facebook&utm_medium=cpc

✅ AFTER:
site.com?page=1&utm_source=facebook&utm_medium=cpc
              ↑
         Changed ? to &

Step 3: Test (10 seconds)

  1. Visit corrected URL
  2. Check GA4 Real-Time
  3. Verify campaign appears

Done.

😰 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

Get Your Free Audit Report

URL Parameter Rules

✅ CORRECT:
?param1=value1&param2=value2&param3=value3
 ↑            ↑             ↑
 ?            &             &

❌ WRONG:
?param1=value1?param2=value2
 ↑            ↑
 ?            ? (should be &)

Rule: First parameter uses ?, all others use &.

Quick Regex Fix

// Find and fix multiple question marks
function fixMultipleQuestionMarks(url) {
    // Split on first ? to get base and query string
    const parts = url.split('?');
 
    if (parts.length <= 1) return url; // No query string
 
    // Reconstruct: base + ? + query (with ? replaced by &)
    const base = parts[0];
    const query = parts.slice(1).join('&'); // Replace ? with &
 
    return `${"{"}{"{"}base{"}"}{"}"}}?${"{"}{"{"}query{"}"}{"}"}}`;
}
 
// Usage
const broken = 'site.com?page=1?utm_source=facebook';
const fixed = fixMultipleQuestionMarks(broken);
console.log(fixed);
// Output: site.com?page=1&utm_source=facebook

Common Causes

Cause 1: URL Concatenation

// ❌ WRONG
const url = baseUrl + '?' + params;
// If baseUrl already has ?, you get double ?
 
// ✅ RIGHT
const separator = baseUrl.includes('?') ? '&' : '?';
const url = baseUrl + separator + params;

Cause 2: Template Logic Error

<!-- ❌ WRONG -->
<a href="{`{"{"}{"{"}base_url{"}"}{"}"}}`}?{`{"{"}{"{"}utm_params{"}"}{"}"}}`}">Link</a>
<!-- If base_url = "site.com?page=1", you get site.com?page=1?utm_... -->
 
<!-- ✅ RIGHT -->
<a href="{`{"{"}{"{"}base_url{"}"}{"}"}}`}&{`{"{"}{"{"}utm_params{"}"}{"}"}}`}">Link</a>
<!-- Or use conditional logic -->

Prevention Checklist

✅ Check if URL already has ? before adding parameters ✅ Use & for all parameters after the first ✅ Validate URLs before launching campaigns ✅ Test in GA4 Real-Time reports

✅ 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

Run Complete UTM Audit (Free Forever)

Join 2,847 marketers fixing their tracking daily

FAQ

Can I have multiple question marks if I URL-encode them?

The first ? starts the query string. Additional ? must be URL-encoded as %3F if they're part of a value.

What if I have three or more question marks?

Replace all except the first with &.

Fix the URLs and set up 301 redirects from old (broken) to new (fixed) format if needed.

How do I prevent this in the future?

Always check if a URL contains ? before adding parameters. Use & if ? exists.

Conclusion

Fix multiple question marks: Replace the second (and any additional) ? with &.

❌ site.com?a=1?b=2?c=3
✅ site.com?a=1&b=2&c=3

30 seconds. Perfect tracking restored.


Technical Reference: Multiple Question Marks Validation Rule