Tracking Form Submission using a Javascript Triggered Goal

THIS ARTICLE WILL HELP YOU:


Introduction

In some cases, a  form that you want to track does not have an "action" attribute, and therefore cannot be tracked with the standard form submission goal template. For those cases, an alternative is to create a Javascript Triggered Goal.

Create a Javascript Triggered Goal

In your Experiment Summary page go to your Goals. Then to Goal Templates and select Javascript Triggered Goal:

 

Name the goal and save it. Once it is saved, go to the goals page and copy its ID:

 

Add JS code on Global Project Javascript

To apply the tracking code on the project, copy the below code into the Global Project JS section located on the Project Configuration, replacing the goal ID with your own:

Code:

window.addEventListener('DOMContentLoaded', (event) => {
convert.$("#formID").submit(function(event) {
window.conv_q = _conv_q || [];
conv_q.push(["triggerConversion", "12345678"]);
});
})

Attach Goal to Experience

Attach this goal to the experience where you want to track submissions:

 

You are ready to go!