Capture only when specific value is selected

gerard_reyes Posted by: Gerard Reyes Date Posted: October 26, 2026
Back to Case Studies

Issue

The website uses 1 form (Contact Us) for the entire site. Architect requested to only capture the lead if “Technology” is selected in the question “What service are you inquiring about?” on the Contact page and the Technology page.

Solution

I added a custom code that stops the form capture when the selected service is not “Technology”.
This only applies to the Contact Us form (gform_2) on the Contact page and the Technology page.
I also created a new mapped form Contact Us – Technology for easier reporting.


mcfx(function(t) {
t.configure("onFormCapture", function(form) {
console.log('MCFX onFormCapture');
console.log(form);
var input_37 = form.querySelector('[name="input_37"]');
var input_37_value = input_37 ? input_37.value : null;
console.log(input_37_value);
var href = window.location.href;
if (form.id === 'gform_2' && (href.indexOf('cbiz.com/contact') !== -1 || href.indexOf('cbiz.com/services/technology') !== -1) && input_37_value !== 'Technology') {
return false;
}
});
});

Achievement

Lead is captured only when “Technology” is selected in the question “What service are you inquiring about?” on the Contact page and the Technology page.

Snippet/Screenshot/Link

Task: Link
Code: Screenshot