Problem/Motivation
The Acquia VWO module's "Customize script visibility" feature, which uses Drupal's condition system (e.g., Request Path with negation), does not prevent the VWO JavaScript from attaching to excluded pages. This results in the script loading site-wide, even on admin paths and specific language prefixes, leading to unnecessary tracking/cookie setting and potential performance issues in multilingual setups.
Environment
Environment:
- Drupal core version: 10.5.6
- Acquia VWO module version: 1.0.2
- PHP version: 8.3
- Database: MySQL 8.0
- Web server: Acquia
- Site setup: Multilingual with path prefix language negotiation (e.g., /en-gb for English-GB, /es-mx for Spanish-Mexico).
Steps to reproduce
- Install and enable the Acquia VWO module.
- Go to Configuration > System > Acquia VWO Connect Settings (setup module and verify it works).
- Go to Visibility tab
- Enable "Customize script visibility".
- Keep "Users cannot control whether or not the VWO integration is enabled." selected
- Add a "Request Path" condition: (keep defaults and add language paths)
- Select "Pages" and enter excluded paths (one per line):
- Keep "Negate the condition" enabled.
- Save the configuration.
- Clear all caches (drush cr or via admin UI).
- Visit excluded pages in a fresh browser/incognito mode:
- Inspect page source (Ctrl+U) and search for "app.vwo" or "vwo".
- Compare negated paths with non negated paths and don't see any difference.
/admin
/admin/*
/batch
/node/add*
/user/*
/block/*
/en-gb
/en-gb/*
/es-mx
/es-mx/*
Admin: /admin/
Language homepage: /en-gb
Language subpage: /en-gb/[some-page, e.g., who-we-are]
Expected Behavior:
The VWO script tag (e.g., from app.vwo.com) should NOT appear in the page source on excluded pages.
No new VWO cookies should be set on isolated visits to these pages.
The module should be effectively "inactive" for those languages/paths, without affecting site-wide configs (which remain inert where the script doesn't load).
Actual Behavior:
The VWO script loads on ALL pages, including excluded ones. Searching the page source for "app.vwo" or "vwo" yields the same number of matches across default language pages, /en-gb, and subpages.
VWO cookies (e.g., _vwo_uuid, _vwo_ds) are set/updated even on excluded pages if the script executes.
This occurs despite negated conditions and cache clears.
Correct Expected Behavior
Is the above the correct expected behavior? I couldn't find any documentation on what to expect when using the Visibility tab to negate the condition of Request Paths.
Issue fork acquia_vwo-3558839
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments