Drupal is a registered trademark of Dries Buytaert
Release: Drupal 10.3.6 Update released for Drupal core (10.3.6)! Release: Drupal 11.0.5 Update released for Drupal core (11.0.5)! Release: Drupal 10.2.9 Update released for Drupal core (10.2.9)! Release: Drupal 10.2.10 Update released for Drupal core (10.2.10)! Release: Drupal 10.3.7 Update released for Drupal core (10.3.7)! Release: Drupal 11.0.6 Update released for Drupal core (11.0.6)! Release: Drupal 10.3.8 Update released for Drupal core (10.3.8)! Release: Drupal 11.0.7 Update released for Drupal core (11.0.7)! Module Revived: Translation Management Tool 8.x-1.19 Module tmgmt updated after 7 months of inactivity (8.x-1.19). Usage Milestone: Account field split Module account_field_split crossed 10,000 active installs.

Webform Conversion-Tracking provides the ability to execute custom JavaScript on the webform confirmation page, typically used for conversion tracking.

Security notice:
The currently used logic to execute JavaScript on the confirmation page needs a security review. Please help to find the best possible implementation! Ensure to grant permissions carefully!

Solved problem & Use-case

In many cases, like for ads and statistics, you may need to run a conversion tracking script for each successfully submitted form. Typically, this is done by JavaScript event snippets provided by the ad companies to include on the confirmation page. Anyway JavaScript is being filtered out on the Webform success message and while Webform provides the "Custom JavaScript" textarea for the whole form and all webform pages, it doesn't provide such a functionality just for the confirmation page / message. Also, it currently misses a good way to detect that kind of page.

Background:
Based on the closed (won't fix) discussion in #2985633: Execute javascript on submission (e.g. conversion tracking) we created this module to provide a simple alternative for site admins to execute a custom (e.g. conversion tracking code) JavaScript on the form confirmation page.

Note: This currently only works with the following confirmation types:

  • Page
  • Inline

For details, see: #3314878: Module currently only works with Confirmation type "Page" and "Inline" (Module tests fail, because they check ALL confirmation types, we let them fail, until the issue is resolved.)

Security

Being able to set custom JavaScript is potentially dangerous. So be careful who you grant the permission to administer the JavaScript or change the configuration (where the JS is stored).

Installation

  • Require the module and dependency via composer require drupal/webform drupal/webform_ct.
  • Install the module using drush en webform_ct.

Usage

  • Go to the webform, you would like to apply the custom confirmation javascript code to and edit the webform's settings. (/admin/structure/webform/manage/my-webform/settings)
  • Click the "Confirmation" Tab and select either the "Page" or "Inline" confirmation type.
  • Once selected a "Confimation Javascript Code" text-field will appear on the bottom of the form.
  • Type in your custom javascript code and save.
  • Done! Now your custom javascript will execute on every webform submit!

Alternatives

Supporting this module

Support DROWL's ♥ FOSS work on this module on OpenCollective!

Drupal and this module are FOSS. However, it takes dedicated people to develop and maintain. And they need YOU to give back!

We're committed to building and maintaining Drupal modules that benefit the entire community.

Supporting us on OpenCollective helps us continue to improve, innovate and contribute to Drupal's future. Every pledge makes a difference!

If this module has helped you, we would be very grateful for your donation to support its further development and maintenance.

Support our FOSS development ♥️

You can also speed up the development of features or bugfixes you'd love to see, by sponsoring and giving back!

Sponsor a feature or bugfix 🚀

Let's make Drupal even better, together!

Development proudly sponsored by German Drupal Friends & Companies:

webks: websolutions kept simple (https://www.webks.de)
and
DROWL: Drupalbasierte Lösungen aus Ostwestfalen-Lippe (OWL), Germany (https://www.drowl.de)

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.

Activity

Tracked releases
1
Tracked since
Dec 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Dormant

Releases

Version Type Core Release date
1.0.0-alpha3 Pre-release Dec 18, 2024