Skip to content

Instantly share code, notes, and snippets.

@luongngocminh
Created September 14, 2023 08:38
Show Gist options
  • Save luongngocminh/ba583ca53a8697193b5c1f11331bcd82 to your computer and use it in GitHub Desktop.
Save luongngocminh/ba583ca53a8697193b5c1f11331bcd82 to your computer and use it in GitHub Desktop.
Hijack Engagebay form redirection to add external params like UTM
// Hijacking Engagebay HTML form submission redirection
// By: Luong Ngoc Minh
// Usage: Replace the original form submit function
function onSubmit(e, t) {
e.preventDefault();
window.EhForm.redirect_to_url = function(a, f, i, b) {
var g = f;
try {
g = JSON.parse(f);
} catch (h) {
console.log(h);
}
var j = {
subscriber_data: JSON.stringify(g),
};
var c = a;
c = eh_mustache_fill_Subscriber_Data(g, c);
if (i) {
c = EhSync.prepareURL(c, j);
}
var d = window.open(c + document.location.search, b ? "_blank" : "_self");
d.location;
};
window.EhForm.submit_form(e, t);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment