Temporarily override MCFX Module to capture form

gerard_reyes Posted by: Gerard Reyes Date Posted: May 22, 2024
Back to Case Studies

Issue

The MCFX Pixel module installed on the client’s site is just view and stream. The form is not included in the installed module, so no form or lead is being captured.

Solution

I created a script in Google Tag Manager to temporarily override the MCFX Pixel module and include a form so the lead will be captured.

document.addEventListener('click', function(event){
     if ([
         "MainAreaContent_lbSend",
         "MainAreaContent_btnSend",
         "MainAreaContent_btnSubmit",
         "MainAreaContent_lbSubmit",
         "MainAreaContent_lbApply",
     ].indexOf(event.target.id) > -1) {
     mcfx(function(tracker){
         var form = event.target.closest('form');
         var id = window.location.pathname.slice(1).replace('/', '-');

         form.id = id;

         tracker.enableModule('forms');
         tracker.capture(form);
     });
     }
});

Edit: Nico just gave me a great tip for this issue. Under the client’s MarketingCloudFX Pixel Configure your MarketingCloudFX Pixel setting. You can also update the Modules there. However, this change usually takes a day to take effect. But still good to know that there is another option. Thanks Nico.

Achievement

Lead was captured.

Snippet/Screenshot/Link

Link: Ticket