If you may have a large number of Marketo forms across your site, or you find that you're adding and removing forms all the time, tracking these forms individually may quickly become unscalable. Below, we'll talk about how to ensure you're tracking all of your Marketo forms, as well as a strategy to track specific forms.
Track all Marketo forms
In order to track all Marketo forms submissions, the script below should be placed in the <head> of all pages on your site. You may choose to use a tag manager like Google Tag Manager to place this script.
You can change the 'marketo-form' conversion name in the script to change how the conversion will be shown within Mutiny.
MktoForms2.whenReady(function(form) {
//Add an onSuccess handler
form.onSuccess(function(values, followUpUrl) {
//Track Mutiny conversion
window.mutiny.client.trackConversion({ name: 'marketo-form'})
});
});
Track specific Marketo forms
The script below can be used to track specific Marketo forms submissions, regardless of where they appear on the site. This script can still be placed across "All Pages" using Google Tag Manager and you can edit the 12345 below to include any form ID you'd like.
MktoForms2.whenReady(function(form) {
var formId = form.getId()
if(formId === 12345){
//Add an onSuccess handler
form.onSuccess(function(values, followUpUrl) {
//Track Mutiny Conversion
window.mutiny.client.trackConversion({ name: 'marketo-form'})
});
}
});
The Marketo form ID is always a 4 digit number. To find the Marketo form Id of a specific form, right click the form, click "Inspect" and navigate to the <form> element in the source code. You'll see an id attached to that form that looks like id="mktoForm_1009". The form ID in this case is 1009.
Comments
0 comments
Please sign in to leave a comment.