How to Fix UTM Tracking on the Pantheon platform

We've been a long time Pantheon partner since the beginning of their program. I remember meeting the team for the first time at the San Diego Drupal Camp that was hosted in early 2012 at Balboa park. As a Drupal agency, we've always admired their commitment to development operations, or DevOps as we call it in the industry. One quirk that we've had over the years is with paid media and how pantheon handles UTM parameter tracking. There's a good chance that if your Drupal site runs on Pantheon, and if you PANTHEON_STRIPPED, inside GA4 or your CRM, your UTM tracking is broken and paid-traffic attribution is leaking.

What is PANTHEON_STRIPPED?

PANTHEON_STRIPPED is the placeholder Pantheon puts in place of the real value of every utm_* and __* query parameter before the request reaches Drupal (Pantheon docs). Your campaign links do not change. Only the copy of the URL that PHP receives does.

Pantheon does this to cache better. ?utm_campaign=spring and ?utm_campaign=fall return the same page, so Pantheon's edge cache ignores UTM parameters and serves both visits from one cache entry (caching docs).

The trade-off is that the real UTM values exist only in the visitor's browser. Pantheon says plainly that stripped values "cannot be read with PHP". JavaScript can still read them from the address bar.

Why PANTHEON_STRIPPED breaks UTM tracking in Drupal

Three things go wrong when Drupal code touches UTM parameters on Pantheon:

  • Webform saves PANTHEON_STRIPPED instead of the campaign. Webform's #prepopulate fills hidden UTM fields from the server-side query string, so each lead is saved with PANTHEON_STRIPPED as its source, medium and campaign. Those values then go on to the CRM, such as Salesforce or HubSpot.
  • Google Analytics 4 records a fake campaign. Any code that builds links from the current request copies ?utm_campaign=PANTHEON_STRIPPED into the page: facet links, pagers, a form's action URL. When a visitor clicks one, GA4 starts a new session with a campaign called PANTHEON_STRIPPED, and the visit's real source is lost.
  • Redirects can drop the campaign. Pantheon restores the real values in a 301/302 Location header only when the parameters match the original request. A Drupal redirect that rewrites the query string loses them.

How we fixed PANTHEON_STRIPPED in Drupal

We fixed it in two steps: the browser captures the real UTM values, and Drupal stops passing the placeholder along.

Step 1: Capture UTM parameters with JavaScript

Our tracking script reads the UTM parameters from window.location, the only place they are real. It saves them to a first-party cookie so they survive the visit. If a link arrives with PANTHEON_STRIPPED in place of the real values, the script ignores them and leaves the existing cookie alone, so a campaign captured earlier is not overwritten.

When a Webform loads, the script fills the hidden UTM fields with the current URL's values first and the cookie's values second. A final check clears any field still holding PANTHEON_STRIPPED, so the placeholder never reaches the CRM.

Step 2: Remove PANTHEON_STRIPPED with a Drupal HTTP middleware

We added a small Symfony HTTP middleware to our custom Drupal module. It runs before Drupal's page cache and routing. If the query string contains PANTHEON_STRIPPED, it removes those parameters from the request. Every link, pager and form action Drupal then builds is clean, so Google Analytics never sees a fake campaign.

Redirects need one extra step. If Drupal returns a 301 or 302, the middleware adds the removed parameters back to the Location header. The Location then matches the original request, so Pantheon's edge can restore the real values and the campaign survives the redirect.

The core of the middleware, simplified:

// mymodule.services.yml: tag as http_middleware, priority 600

// (runs before page_cache).

public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE): Response {

 $qs = (string) $request->server->get('QUERY_STRING', '');

 if ($type !== self::MAIN_REQUEST || !str_contains($qs, 'PANTHEON_STRIPPED')) {

   return $this->httpKernel->handle($request, $type, $catch);

 }

 $kept = $stripped = [];

 foreach (explode('&', $qs) as $pair) {

   $value = urldecode(explode('=', $pair, 2)[1] ?? '');

   $value === 'PANTHEON_STRIPPED' ? $stripped[] = $pair : $kept[] = $pair;

 }

 // Rebuild the request (query, QUERY_STRING, REQUEST_URI) from $kept.

 $response = $this->httpKernel->handle($this->clean($request, implode('&', $kept)), $type, $catch);

 if ($response->isRedirect()) {

   // Append $stripped back to Location so Pantheon's edge restores the values.

   $this->restoreOnRedirect($response, $stripped);

 }

 return $response;

}

No contrib module, no Pantheon support ticket and no changes to campaign URLs. The fix lives in one custom module shared by every site in the Drupal multisite.

Checklist: UTM tracking for Drupal sites on Pantheon

To check whether you are affected, search your Webform submissions and your GA4 campaign report for PANTHEON_STRIPPED. Then:

  1. Never read utm_* or __* values in PHP. That includes Webform's #prepopulate on hidden tracking fields.
  2. Capture UTM parameters in JavaScript from window.location, and keep them in a first-party cookie.
  3. Remove the placeholder from the request before Drupal builds any URLs, and put it back on redirects.
  4. Share campaign URLs in their final form, without redirects (for example, point an ad at https://example.com/spring-sale, not at an old /promo alias that redirects there), as Pantheon recommends.

Should you turn off Pantheon's edge cache?

No. UTM parameters don't change what a page shows, so caching a separate copy for every campaign would be pure waste. Because Pantheon ignores them, every ad click can be served from the edge cache instead of waiting on Drupal. Paid landing pages stay fast exactly when campaign traffic spikes, which helps conversions, Core Web Vitals and your Google Ads landing page experience. The bug isn't the cache. It's Drupal code that reads UTMs on the server.

PANTHEON_STRIPPED FAQ

What does PANTHEON_STRIPPED mean?

It means Pantheon's edge cache replaced a utm_* or __* query parameter value before the request reached your site. The real value is still in the visitor's browser URL.

Does Pantheon strip gclid, fbclid or msclkid?

Pantheon's docs list only utm_* and __*. Other parameters, including ad click IDs, reach Drupal unchanged. In the form data we checked, click IDs always arrived intact.

Why does PANTHEON_STRIPPED show up as a campaign in Google Analytics 4?

Drupal printed the placeholder into a link on the page, and a visitor clicked it. GA4 reads the UTM tags in that URL and starts a new session with PANTHEON_STRIPPED as the campaign.

Can I read the real UTM values in PHP on Pantheon?

No. Pantheon states that stripped values "cannot be read with PHP". Read them in JavaScript and pass them to the server through a cookie or a hidden form field.

Does this affect WordPress sites on Pantheon?

Yes. The stripping happens at Pantheon's edge, before any CMS runs, so WordPress sees the same placeholder. The approach is the same; the code is different.

‍

Subscribe to our Newsletter

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Built on Community.
Proven in the Real World.

Our community has always mattered to us. We proudly support open-source platforms, sponsor local professional groups, and invest time to strengthen the industry as a whole, not just our bottom line.