Handling Stripped UTM Parameters in Drupal on Pantheon

Digital Marketing Performance Dashboard

Marco Bouwer of The Savvy Few explains how to handle Pantheon’s automatic stripping of "utm_" query parameters, which replaces their values with "PANTHEON_STRIPPED" to optimize caching performance. Since these stripped values are inaccessible via PHP, Marco outlines a JavaScript-based solution for retrieving and storing them within a Drupal webform submission. 

The approach involves adding hidden fields in the webform for utm_source, utm_medium, and utm_campaign and using a custom JavaScript library, crmleads.js, to pre-fill these fields by extracting values from the URL. A helper function ensures basic XSS prevention, while a Drupal library definition file, crmleads.libraries.yml, loads the script. Additionally, the implementation of hook_webform_submission_form_alter() allows the JavaScript to conditionally load for relevant CRM webforms. 

This method ensures that marketing-related UTM parameters can be captured and utilized within a Drupal application without affecting Pantheon’s caching mechanisms.

Reference: Handling Stripped UTM Parameters in Drupal on Pantheon , The Savvy Few (21 February 2025)

Disclosure: This content is produced with the assistance of AI.

Disclaimer: The opinions expressed in this story do not necessarily represent that of TheDropTimes. We regularly share third-party blog posts that feature Drupal in good faith. TDT recommends Reader's discretion while consuming such content, as the veracity/authenticity of the story depends on the blogger and their motives. 

Note: The vision of this web portal is to help promote news and stories around the Drupal community and promote and celebrate the people and organizations in the community. We strive to create and distribute our content based on these content policy. If you see any omission/variation on this please reach out to us at #thedroptimes channel on Drupal Slack and we will try to address the issue as best we can.

Related Organizations

Upcoming Events

Latest Opportunities