Skip to content

Instantly share code, notes, and snippets.

@MurtzaM
Last active August 29, 2015 14:06
Show Gist options
  • Save MurtzaM/9c6d3a0a2aed9ebfde85 to your computer and use it in GitHub Desktop.
Save MurtzaM/9c6d3a0a2aed9ebfde85 to your computer and use it in GitHub Desktop.
This script deletes Marketo tracking cookie after Marketo form submission
// This script deletes Marketo tracking cookie after Marketo form submission
// When a form is submitted by a user, the deleteMarketoCookie function is called
// Created by Murtza Manzur on 08/22/14
//Load Marketo forms script.
<script src="//app-sjqe.marketo.com/js/forms2/js/forms2.js"></script>
<script>
function delete_cookie (name, path, domain) {
document.cookie = name + "=" +
((path) ? ";path="+path:"")+
((domain)?";domain="+domain:"") +
";expires=Thu, 01 Jan 1970 00:00:01 GMT";
}
function delete_marketo_cookie () {
delete_cookie ( '_mkto_trk', '/', '.marketo.com');
}
//Replace the parameters passed to loadForm method with the following:
//First parameter is your Marketo instance URL
//Second parameter is your Munchkin ID
//Third parameter is your Form ID
MktoForms2.loadForm("//app-aaa.marketo.com", "111-AAA-111", 0000, function(form){
//Add an onSuccess handler
form.onSuccess(function(){
//Call function to delete Marketo tracking cookie on form submission
delete_marketo_cookie ();
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment