Last active
July 22, 2016 20:08
-
-
Save msure/943869a4eae6a6228ba4e1d6c4a150e4 to your computer and use it in GitHub Desktop.
Detailed Walk-Through of Marketo Form Values To DayaLayer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// all the marketo from 2.0 javascript has successfully loaded, so we can continue | |
MktoForms2.whenReady(function (form) { | |
// the user has just submitted the form | |
form.onSubmit(function(){ | |
// marketo provides a form object with a nifty method to get the values from the form | |
// we'll store those values in a "vals" variable | |
var vals = form.vals(); | |
// now we can push to the dataLayer | |
dataLayer.push({ | |
// we get two types of information from this dataLayer push | |
// the first is the fact that a marketo form was submitted | |
// in other words: hooray, we got a lead! | |
'event': 'marketoFormSubmit', | |
// the second type of information is about the lead itself | |
// your marketo setup/form will differ; play with the values to get what you need | |
// just be super careful about personally identifiable info!! | |
'marketoCompany': vals['Company'], | |
'marketoLeadSource': vals['LeadSource'], | |
'marketoOriginalSource': vals['Original_Source_Detail__c'], | |
'marketoCurrentSource': vals['Source_Detail__c'] | |
}); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment