Part of the Webform ecosystem · 217 projects
This module allows you to capture JavaScript settings or properties from your web page and include them in your webform submissions. It can pull information like the user's browser type or Google Analytics Client ID to enrich your form data.
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.
Ask your assistant about Webform JavaScript Setting
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
More in the Webform ecosystem
Most installed first
Activity
Release Timeline
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 1.0.0-alpha6 | Pre-release | 9–11 | Sep 10, 2026 | ||
| 1.0.0-alpha5 | Pre-release | 9–11 | Feb 26, 2025 | ||
| 1.0.0-alpha4 | Pre-release | 9–10 | Oct 11, 2023 | ||
| 1.0.0-alpha3 | Pre-release | 9 | Jun 15, 2023 | ||
| 1.0.0-alpha2 | Pre-release | 9 | May 16, 2023 | ||
| 1.0.0-alpha1 | Pre-release | 9 | Apr 12, 2023 | ||
| 1.0.x-dev | Dev | 9–11 | Apr 12, 2023 |