Elementor Forms

Integrate conversion tracking with Ruler Analytics and your Wordpress Elementor Forms

If you are using Elementor form builder, you can apply this additional script to the footer of your website before the closing </body> tags located in the Footer file on your website, to track the submitted values as a conversion to Ruler Analytics.

The script can be applied to your website directly or as a Custom HTML tag in Google Tag Manager.

We recommend this fires on all pages on site.

<script>
  jQuery(document).on('submit_success', function (event) {

    // Get the closest Elementor form
    var $form = jQuery(event.target).closest('form.elementor-form');
    if ($form.length === 0) {
      return;
    }

    var payload = {};

    $form.find('input[name], textarea[name], select[name]').each(function () {
      var $field = jQuery(this);
      var name = $field.attr('name');
      var type = $field.attr('type');

      if (type === 'checkbox') {
        if (!$field.prop('checked')) return;
        if (!payload[name]) {
          payload[name] = [];
        }
        payload[name].push($field.val());
      } else if (type === 'radio') {
        if ($field.prop('checked')) {
          payload[name] = $field.val();
        }
      } else {
        payload[name] = $field.val();
      }
    });
    var cleanedPayload = {};
    Object.keys(payload).forEach(function (key) {
      var cleanKey = key.replace(/^form_fields\[|\]$/g, '');
      cleanedPayload[cleanKey] = payload[key];
    });
	
	               RulerAnalytics.trackConversionAsync(cleanedPayload,"","",500);

  });
</script>

To test the additional script you can follow our guide here.

If you have any questions, please email [email protected]