The Newsletter is firing two capture events: one from the default MCFX capture event and another from the Hubspot iframe capture event.
The Newsletter is not implemented as an iframe but as a direct form on the client’s site. So, this should not be included in the Hubspot iframe capture event.
I added an exclusion in the Hubspot iframe listener code to ignore the Newsletter.
window.mcfxCaptureCustomFormData = function( data, formId ) {
var formEl = document.createElement('form');
if (formId === 'hsForm_49f6d05c-fb98-4e1f-b844-d2541a9840bb') {
// This is Newsletter. It is not in iframe, so it should not process it.
return false;
}
formEl.id = formId;
var cacheOriginalSessions = window.sessionStorage.getItem('fxFormSessions') || '{}';
Object.keys(data).map(function(key){
var fieldEl = document.createElement('input');
fieldEl.type = 'hidden';
fieldEl.name = data[key].name;
fieldEl.value = data[key].value;
formEl.appendChild(fieldEl);
});
mcfx( 'capture', formEl );
window.sessionStorage.setItem('fxFormSessions', cacheOriginalSessions);
console.log('MCFX capture success');
}
The duplicate issue is fixed.
Ticket: Link