Triggering a click goal on an element that its not part of the DOM when the page loads

Sometimes, we might want to monitor clicks on an element (button, link, or any), that might not be part of the DOM when the page initially loads.

This occurrence would usually be reflected in causing that a standard "Click Goal" is not triggered with the normal setup.

Many applications, especially third party, load form elements, buttons and others after the page has completely loaded.

However, there is a way to overcome this issue. The secret is to create a click event on the element that we are going to track with a piece of code.

The following code can be added on the Experience Custom JS or Global Project JS sections, depending where you want to track it.

Here is the sample of the code


convert.$(document).ready(function() {
   convert.$("#co-billing-form").on("click","#opc-review .continue_button",function() {
   window._conv_q = window._conv_q || [];
// please modify the following code to include the number of the JS Goal or click goal you have already created
   _conv_q.push(["triggerConversion","123456789"]);
  }

})
Have more questions? Submit a request

Comments