~~~ Please read before posting. ~~~

Important: We need your Club Number at a minimum, and as many details as possible.
For further info please read This page before posting.

Google Analytics script head in wrong place?

  • DF_Dunedin
  • DF_Dunedin's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 5
  • Thanks: 0

Google Analytics script head in wrong place?

6 years 1 month ago
#76296
Hello FTH gurus

I have just inherited our FTH webpage - dunedin.toastmastersclubs.org/ - and have begun the process of renovating it.

For analytics, have received a <head> script tag from Google, and placed this in the "Google Analytics Script Code" box in the admin console.
Code:
<!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-144859337-2"> </script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-144859337-2'); </script>

However when this is done, Google is still reporting that the tag is missing.

When I view our page source, it appears that the script is being injected into the HTML body rather than the page head.

I wonder if I have done something dumb or if this is a real bug?

Many thanks in advance
Doug F, Dunedin NZ
Dunedin Toastmasters (New Zealand)
Club #2890
The topic has been locked.
  • DF_Dunedin
  • DF_Dunedin's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 5
  • Thanks: 0

Re: Google Analytics script head in wrong place?

6 years 1 month ago - 6 years 1 month ago
#76306
I just want to clarify my issue here. I don't actually care where the tag sits and I understand there are very good arguments for it being located in different places in the head or body.

My issue is that the tag, placed where it is, does not seem to be detected by Google on our page.

I have installed the tag in the admin console and as far as I can see I did it all exactly as directed, and can confirm the tag is appearing in the page's source. But, if I use Google Webmaster Tools, I get this:
Verification method: Google Analyics
Failure reason: We could not find any Google Analytics tracking codes on the index page of your site...
i.imgur.com/B5z8Y7H.png

And in another Google Console
No tag found / No smart campaign ID/tag was found on your website...
i.imgur.com/A1y0pa5.png
(Sorry I can't hotlink the images)

I tried using both http:// and https:// and carefully checked the URL, but no difference.

My assumption was the placement of the tag was causing the problem but that could be irrelevant

Thanks again
Doug
Dunedin Toastmasters (New Zealand)
Club #2890
Last edit: 6 years 1 month ago by DF_Dunedin.
The topic has been locked.
  • SteveTheTechie
  • SteveTheTechie's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 11526
  • Thanks: 3050

Re: Google Analytics script head in wrong place?

6 years 1 month ago
#76307
I can see the GA script code in the page source. Try clearing your browser cache.
The topic has been locked.
  • wesb
  • wesb's Avatar
  • FreeToastHost Ambassador
  • FreeToastHost Ambassador
  • Thanks: 0

Re: Google Analytics script head in wrong place?

6 years 1 month ago
#76318
Steve...

I know that our European compliance implementation doesn't put the Google Analytics stuff in unless the visitor accepts cookies, and i can see the GA stuff only after accepting them. In their site, I need to try to log in as site admin before getting the option to accept cookies. I'd suspect that Google won't try to do this.

Under these circumstances, it's possible that Google truly won't see the GA code?
The topic has been locked.
  • DF_Dunedin
  • DF_Dunedin's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 5
  • Thanks: 0

Re: Google Analytics script head in wrong place?

6 years 1 month ago
#76319
I tried emptying the browser cache and it made no difference. I can see the code in the page's source but Google's dashboards seem to struggle.
Dunedin Toastmasters (New Zealand)
Club #2890
The topic has been locked.
  • SteveTheTechie
  • SteveTheTechie's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 11526
  • Thanks: 3050

Re: Google Analytics script head in wrong place?

6 years 1 month ago
#76326
If the system is inserting the code as expected, but you are still having issues, then maybe you should get support from Google about why they cannot see it.
The topic has been locked.
Moderators: BrianJane AtkinsonPamrhtaylor3marc33NotLiablejgavinLcala305peterb323
Time to create page: 1.953 seconds