Tracking Form Submission using a Javascript Triggered Goal

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:

mceclip0.png

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

mceclip1.png

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:

mceclip0.png

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:

mceclip2.png

You are ready to go!

Need assistance? Start a conversation with our Support Team.
CONVERT MORE

Reliably Convert More Site Visitors, Even If Everything Else is Changing in Your Business.

START 15-DAY FREE TRIAL
✓ No Credit Card  ✓ Easy Set-Up  ✓ Access All Features

Comments