AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Ads
5.1K members online now
5.1K members online now
For questions related to Google Shopping and Merchant Center. Learn to optimize your Shopping ads
Guide Me
star_border
Reply

Having trouble to verify & claim website

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi

 

I'm trying to verify and claim my website with help from Google Tag Manager. Though i'm running into a problem, it says that the GTM-snippet is in the wrong location.

Verification failed - The Google Tag Manager snippet on your site is in the wrong location.

This how GTM is implemented on that page.

 

</head>
<body id="body">
	
<!-- Google Tag Manager -->
<script type="text/javascript">
    dataLayer = [ { 'pagePath': '/' }];
    
    
</script>
<script type="text/javascript">
    dataLayer.push({
  "event": "checkout",
  "ecommerce": {
    "checkout": {
      "actionField": {
        "step": 1,
        "affiliation": "webshop"
      }
    }
  }
});
</script>

<noscript><iframe src="//www.googletagmanager.com/ns.html?id=OUR-GTM-CODE" 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','OUR-GTM-CODE');</script>

 

Why do I get this error? It's my understanding GTM should be implemented just after body-tag opens.

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author helslaktadhjort
August 2016

Re: Having trouble to verify & claim website

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

I solved it. dataLayer was causing the error. I instead declared dataLayer within <head></head> and pushed to it after the snippet rather than before. I.e.

 

<script type="text/javascript">
    dataLayer = [ { 'pagePath': '/' }];
</script>
</head>
<body id="body">
  
<!-- Google Tag Manager -->

<noscript><iframe src="//www.googletagmanager.com/ns.html?id=OUR-GTM-CODE" 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','OUR-GTM-CODE');</script>

<script type="text/javascript">
    dataLayer.push({
  "event": "checkout",
  "ecommerce": {
    "checkout": {
      "actionField": {
        "step": 1,
        "affiliation": "webshop"
      }
    }
  }
});
</script>

View solution in original post

Re: Having trouble to verify & claim website

Top Contributor
# 2
Top Contributor
I recommend asking your questions here : https://productforums.google.com/forum/#!forum/tag-manager

Also note that when you ask your questions, to include the platform of your ecommerce that you are using. As the more info you provide the easier it is to solve your issue.

Unfortunately myself, I have not experience with GTM, maybe someone else does.

Good luck.
Twitter | Linkedin | Community Profile | Shopping Feed Tips From FeedArmy
Did you find any helpful responses or answers to your query? If yes, please click on ‘Accept As Solution’
Marked as Best Answer.
Solution
Accepted by topic author helslaktadhjort
August 2016

Re: Having trouble to verify & claim website

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

I solved it. dataLayer was causing the error. I instead declared dataLayer within <head></head> and pushed to it after the snippet rather than before. I.e.

 

<script type="text/javascript">
    dataLayer = [ { 'pagePath': '/' }];
</script>
</head>
<body id="body">
  
<!-- Google Tag Manager -->

<noscript><iframe src="//www.googletagmanager.com/ns.html?id=OUR-GTM-CODE" 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','OUR-GTM-CODE');</script>

<script type="text/javascript">
    dataLayer.push({
  "event": "checkout",
  "ecommerce": {
    "checkout": {
      "actionField": {
        "step": 1,
        "affiliation": "webshop"
      }
    }
  }
});
</script>