[SOLVED][Drupal Webform] How to track Webform submissions with Google Analytics ?

| | 1 min read

Many Drupal users have wanted to know how to track Webform submissions with Google Analytics ?. If you are faced with the same question with Google Analytics and Drupal Webform in your Drupal site then read onto find out the solution.

Here is the solution reported by a Drupal user facing the same issue.

  • Simply add the following code to a JS file in your module
    Drupal.behaviors.basicWorks = function(context) {
      // Track submission events.
      $('#webform-client-form-28', context).submit(function() {
        _gaq.push(['_trackEvent', 'Webform', 'Form submitted', 'New submission']);
      });  
    };
  • Remember to replace the webform id with the id of your webform you wish to track.

Hope that helps.

The easiest way to solve a Drupal issue is to hand it to the Drupal experts. We can provide a wide range of Drupal services to help you maintain and manage your Drupal websites. Get in touch with us to know more.