Google Analytics Pageview Form OnSubmit
Hi everyone,
I have configured my marketo forms to bring users directly to a pdf when they submit the form. Doing so has caused my google analytics goal tracking not to work because it reliese on a page being loaded with "thank-you" in the url which no longer happens.
So I wrote some Javascript to trigger a false pageview in GA that would cause the goal to trigger but I dont see this showing up at all in GA and I don't get any javascript errors when completing the form:
| <script type="text/javascript"> |
MktoForms2.whenReady(function (form){
//Add an onSuccess handler
| form.onSuccess(function() { |
//fire off thank you page goal in analytics
ga('send', 'pageview', '/marketo-thank-you');
//Trigger adwords conversion
// Take the lead to a different page on successful submit, ignoring the form's configured followUpUrl
location.href = "{{my.GBL Link To Asset}}";
// Return false to prevent the submission handler continuing with its own processing
return false;
});
});
</script>
Any ideas as to why this is happening here is a sample page with the code on it: Content Delivery Network (CDN) and Cloud Computing Services Provider | Akamai
Thanks,
Dave.