Skip to content

Instantly share code, notes, and snippets.

@MurtzaM
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MurtzaM/2280e05690c23e18f325 to your computer and use it in GitHub Desktop.
Save MurtzaM/2280e05690c23e18f325 to your computer and use it in GitHub Desktop.
Delete Marketo tracking cookie
// 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 deleteMarketoCookie() {
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
deleteMarketoCookie();
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment