I have a webpage - which i guess is fairly standard.
Basically something like:
<form action="/mywebsite/mypage" method="post" novalidate="novalidate">
<div class="blah">
<input class="form-control" id="name" maxlength="80" name="name" tabindex="1" type="text" value="">
<!-- tonnes more inputs and labels and stuff -->
<input type="submit" class="btn" value="Submit" tabindex="2">
</div>
</form>
But when the submit button is pressed, the form is submitted twice (depending on browser).
Firefox - works fine - submits once consistantly
Chrome - intermittent, mostly works, sometimes submits twice.
IE (Edge) - submits twice 100% of the time
Managed to narrow it down to google tag manager. When this is removed it works fine.
So I have this script in my _layout page (master page, template page, whatever you call it)
<!-- Google Tag Manager -->
<noscript>
<iframe src="//www.googletagmanager.com/ns.html?id=GTM-ABCDEF1"
height="0" width="0" style="display: none; visibility: hidden">
</iframe>
</noscript>
<script>
(function(w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({
'gtm.start':
new Date().getTime(),
event: 'gtm.js'
});
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src =
'//www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-ABCDEF1');
</script>
<!-- End Google Tag Manager -->
So I'm trying to understand what's going on - why it would be causing it - and how to stop it.
I can work around it - but I don't want to. Would rather fix it properly.
Notes: yes for some reason the url starts // rather than https:// - but changing it makes no difference.
Any ideas?
I have a very basic understanding of google analytics - but 0 knowledge about google tag manager.
A bug in GTM, see https://productforums.google.com/forum/?nomobile=true#!topic/tag-manager/QVb2sNyvp5k;context-place=forum/tag-manager for more information. The selected answer isn't really the correct answer.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.