Known Visitor HTML + Redirect Javascript
Hi, community!
I am working on adding Google Analytics 4 tags to our forms to track form submissions per form using this article (https://www.dreweastmead.com/blog/how-to-pass-marketo-form-submissions-through-gtm-into-ga4). The tags work properly on all of our forms except for our forms that we use for downloading content on our site. For these forms, we use known visitor HTML because every form uses the same Marketo form + some custom javascript to redirect to the correct page.
It appears that once we implement these tracking tags in tag manager, the known visitor HTML overrides the Javascript and there is no redirect anymore. When I turn off the GA4 tag, the known visitor HTML form redirects successfully. Here is what my Javascript code looks like for the content downloads:
<script src="//Marketo Script Source"></script>
<form id="Marketo Form"></form>
<script>MktoForms2.loadForm("//Site", "Munchkin ID", Form Name, function(form) {
form.onSuccess(function(values, followUpUrl) {
location.href = "Redirect Site URL Goes Here";
return false;
});
});</script>
Does anyone have any experience with tag manager overriding Known Visitor HTML or custom Javascript?