I’m not a developer so struggling to get this to work… I have the code that needs to be linked, but not sure how to link it using the onFormSubmit string within the form embed.
Here is the embed form code:
hbspt.forms.create({
sfdcCampaignId: 'XXXXXXXXX',
portalId: 'XXXXXXXXX',
formId: 'XXXXXXXXX'
});
Then the code that has been sent across to be added looks like:
dataLayer.push({'event' : 'formSubmitted', 'formName' : 'consultation'});
function onFormSuccess(event) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event' : 'formSubmitted',
'formName' : 'consultation'
});
}
{
form.onSubmit(function(){
dataLayer.push({
'event': 'formSubmitted'
'formName': 'consultation'
});
});
});
@Champion Read through the documentation I posted above. You need to have the link in your hbspt.forms.create function. so underneath formId you would add it.