Advertisement:

Author Topic: Google Analytics Tracking Code  (Read 2246 times)

designz

  • Newbie
  • *
  • Posts: 2
Google Analytics Tracking Code
« on: February 07, 2015, 02:59:31 am »
Hi,

I installed the Google Analytic plugin and entered my code, however when I tried to verify ownership of my website (webmaster tools) I get the following error message "The Google Analytics tracking code on your site is in the wrong location. You can verify site ownership with the asynchronous snippet placed in the <head> section of your home page".

Kindly assist me with this problem. Thanks in advance

Aficionado

  • Guest
Re: Google Analytics Tracking Code
« Reply #1 on: February 07, 2015, 11:37:18 am »
Hi,

I installed the Google Analytic plugin and entered my code, however when I tried to verify ownership of my website (webmaster tools) I get the following error message "The Google Analytics tracking code on your site is in the wrong location. You can verify site ownership with the asynchronous snippet placed in the <head> section of your home page".

Kindly assist me with this problem. Thanks in advance

Yes, the plugin puts the script at the footer. I have posted about it many times. And Google requires it at the header.

You must REMOVE the plugin and manually add the script in your theme's header.


dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2155
  • osclass.work
Re: Google Analytics Tracking Code
« Reply #2 on: February 07, 2015, 02:49:50 pm »
This is because many themes may not have traditional header, but usually all of them have common footer template file.

Regards

Aficionado

  • Guest
Re: Google Analytics Tracking Code
« Reply #3 on: February 07, 2015, 03:23:46 pm »
This is because many themes may not have traditional header, but usually all of them have common footer template file.

Regards

No, it is because a few years ago Google wanted the analytics script at the footer but now it is changes (now=2-3 years ago).

And what is the purpose of this plugin, if it can't be used any more ?

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2155
  • osclass.work
Re: Google Analytics Tracking Code
« Reply #4 on: February 07, 2015, 04:21:55 pm »
Maybe, I cannot quite remember the right example now, but sure I've seen some themes and plugins where that would not work if put inside header. And besides, it is meant for beginners and factory themes for easier use. If you know what to do with the code, you don't need the plugin at all.

Regards

Aficionado

  • Guest
Re: Google Analytics Tracking Code
« Reply #5 on: February 07, 2015, 04:28:04 pm »
Maybe, I cannot quite remember the right example now, but sure I've seen some themes and plugins where that would not work if put inside header. And besides, it is meant for beginners and factory themes for easier use. If you know what to do with the code, you don't need the plugin at all.

Regards

The old logic was to "let" the page to fully load and THEN count it with analytics at the footer. Now with the async code, it doesnt' matter.

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2155
  • osclass.work
Re: Google Analytics Tracking Code
« Reply #6 on: February 07, 2015, 04:30:23 pm »
Yes, I know why Google shifted to header, just saying there's another collateral reason.

PS: depending on the theme, code should be put inside head.php (~ all themes) and not the literal header.php file (may work for some themes, but not all have the "window" spot there).

Regards