Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Webform Conversion-Tracking

Security covered Under active development 97 sites

Part of the Webform ecosystem · 216 projects

This module allows you to add custom JavaScript code that will run specifically on your webform's confirmation page. This is useful for tracking conversions from ads or analytics when a form is successfully submitted. It currently supports "Page" and "Inline" confirmation types.

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)

Ask your assistant about Webform Conversion-Tracking

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.

Activity

Tracked releases
2
Tracked since
Sep 2023
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Active

Releases

Version Type Core PHP Release date
1.0.0-alpha3 Pre-release 8–11 Dec 18, 2024
1.0.0-alpha2 Pre-release 8–10 Sep 29, 2023