This project is not covered by Drupal’s security advisory policy.
The Webform JavaScript Setting module provides a hidden Webform element that captures a value from a JavaScript property or method and includes it with the submission. The module can capture properties from window.navigator, drupalSettings, JavaScript-based tracking software, and browser cookies.
Use cases
The module can be used to capture information such as:
- A Google Analytics client ID, allowing Webform submissions to be correlated with Analytics sessions.
- The browser user agent, such as Chrome or Firefox.
- An identifier or other value stored in a browser cookie available to JavaScript.
Configuration
- Go to the Webform configuration page and open the third-party settings.
- Add each JavaScript setting with a machine name, JavaScript declaration, and label.
- Add a JavaScript Setting element to a webform and select the declaration to capture.
Supported declarations
JavaScript properties can be entered using dot notation. Methods without arguments are also supported.
Examples include:
-
navigator.userAgentcaptures the browser's user agent. -
drupalSettings.user.uidcaptures the current Drupal user ID. -
WebformJavaScriptSettingTest.getcalls theget()method and captures its return value. -
document.cookiecaptures the complete cookie string available to JavaScript. -
document.cookie.[name]captures the raw value of the named cookie. For example,document.cookie.analytics_idcaptures the value of theanalytics_idcookie.
Cookies that are unavailable to JavaScript, including cookies marked HttpOnly, cannot be captured.
Supporting organizations:
Project information
- Ecosystem: Webform
9 sites report using this module
- Created by jrockowitz on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
Releases
1.0.0-alpha6
released 10 September 2026
Works with Drupal: ^9.4 || ^10 || ^11
Install:
Development version: 1.0.x-dev updated 10 Sep 2026 at 21:39 UTC


