Get Paid to Participate - up to $1 per post!     Twitter     Facebook     Google+
Hosting Discussion
 

forgot password?



Reply


Old
  Post #1 (permalink)   01-21-2012, 07:39 PM
HD Newbie
 
Join Date: Jan 2012
Posts: 20

Status: Grabahost is offline
It's silly but I couldn't find the place to put Google analytics code on one of my Wordpress blog. It should be in the head section, right? It must be the theme I am using, because I couldn't find the head section from the editor page.
 
 
 


Old
  Post #2 (permalink)   01-21-2012, 10:30 PM
HD Wizard
 
Join Date: Mar 2005
Location: Atlanta, GA
Posts: 2,264

Status: handsonhosting is offline
Google Analytics should NOT go in the header - you want this to be the last thing to load. You want all scripts as close to the bottom as possible so that it doesn't negatively affect the page loading times on your site.

There are a number of Google Anayltics plugins that you can install into Wordpress, but as you mentioned, you'll want to check the Theme that you're using. Sometimes it's included in the Theme, sometimes it's not.

Either way, you can easily just add the code into the FOOTER of your site - not the header.
__________________
Emerson Nogueira
http://www.HandsOnWebHosting.com
cPanel Web Hosting, Domain Registration, Managed VPS Servers
 
 


Old
  Post #3 (permalink)   01-22-2012, 12:05 AM
HD Addict
 
Join Date: Oct 2011
Posts: 177

Status: Bullten is offline
Google analytics code must be in header. It was with old google analytics code that people used to place it in footer.

This is new asynchronous code which one should put just below closing </head>. If you have a javascript above google analytics code then its possible that if the above script failed to execute then google analytics may also respond as error.

This is a asynchronous google analytics code and if there is any error in the code for the time being , your site will load properly without hanging or showing errors. Thats why its called as asynchronous tracking code

Placing asynchronous analytics tracking code in <body> have proved that their data is missing or not correct.

So my suggestion would be open wordpress header file and place the tracking code there...

Last edited by Bullten : 01-22-2012 at 12:07 AM.
 
 


Old
  Post #4 (permalink)   01-22-2012, 04:50 AM
HD Newbie
 
Join Date: Jan 2012
Posts: 20

Status: Grabahost is offline
Thanks for the advice guys, though I am a bit confused now. I would love to place the code on the footer if it is what I were supposed to do.

Anyway Bullten, does it mean I need to modify the core Wordpress file?
 
 
 


Old
  Post #5 (permalink)   01-22-2012, 09:14 AM
HD Newbie
 
Join Date: Jan 2012
Location: London, UK
Posts: 20

Status: chrisj is offline
I've always placed mine in the header, before the closing </head> tag.

You don't need to do any file editing, you should be able to add the code in via the theme editor in Wordpress. Look for the header.php file and then paste the tracking code in there (before closing </head>)
__________________
- Chris
 
 
 


Old
  Post #6 (permalink)   01-22-2012, 09:23 AM
HD Addict
 
Join Date: Oct 2011
Posts: 177

Status: Bullten is offline
follow the instruction of chisi and place the code in respective place. Remember you are going to use asynchronous code and before </head> is the right place for it if you don't want the data go missing.
 
 
 


Old
  Post #7 (permalink)   01-22-2012, 12:56 PM
HD Wizard
 
Join Date: Mar 2005
Location: Atlanta, GA
Posts: 2,264

Status: handsonhosting is offline
I've always used the bottom as I never want to track a page that only partially loads (or a bounce in that regard).

Going to Google's current page at http://www.google.com/analytics, and then clicking to the option about how to install it, you get this page;

http://support.google.com/googleanal...t&answer=55488

This is for the traditional method (installing at the bottom before </body>)

There's then a link on the page to the NEW method (asynchronous) where they say to insatall it before the </head> tag;

http://support.google.com/googleanal...&answer=174090

For us, we've always used the bottom of the page method.
__________________
Emerson Nogueira
http://www.HandsOnWebHosting.com
cPanel Web Hosting, Domain Registration, Managed VPS Servers
 
 
 


Old
  Post #8 (permalink)   01-22-2012, 01:15 PM
HD Newbie
 
Join Date: Jan 2012
Location: London, UK
Posts: 20

Status: chrisj is offline
Ah I didn't realise that there were two ways, useful to know. :-) I wonder if there is any difference between the asynchronous and non-asynchronous codes?
__________________
- Chris
 
 
 


Old
  Post #9 (permalink)   01-22-2012, 02:49 PM
HD Addict
 
Join Date: Oct 2011
Posts: 177

Status: Bullten is offline
There is a big difference. Several functions were combined together to for a single function where user don't have to write big syntax for each and instead of that he can use the function to pass the value. Search on google you will get idea.

I will tell you why the traditional code was placed in footer and new asynchronous was placed in header.

Well that code was a big problem for users when some thing goes wrong with GA tracking code. If that code returns error or suppose google analytics is down for a while and you placed that code in header then your page will not load completely. It will show only header and rest of the code stops and incomplete page is displayed to the end user . To overcome this they came to a conclusion that this traditional code must be placed into footer.

Now they had the challenge in front of them to resolve this issue.

Probability:
Suppose someone came to your site and by mistake his browser crashed or net got disconnected or he went away without the execution of analytics code which was placed in footer and his visit was never recorded. But why? It was a visit. Isn't it?.

To over come this google launched asynchronous code because when someone comes on your site the first thing gets executed is the header part.So, if Google analytics code fail to execute because of some error then also your site loads completely and thats why it was placed in header.

Last edited by Bullten : 01-22-2012 at 03:00 PM.
 
 


Old
  Post #10 (permalink)   02-01-2012, 01:09 PM
HD Newbie
 
Join Date: Sep 2009
Posts: 39

Status: backhost is offline
is analytics the best tracking software out there?
__________________
Clickcloudit.com
TrueSSD The high-performance VPS
at an affordable price
 
 
 


Old
  Post #11 (permalink)   02-01-2012, 02:00 PM
HD Addict
 
Join Date: Oct 2011
Posts: 177

Status: Bullten is offline
As free its best but if you can pay then buy http://www.omniture.com/en/products/analytics
 
 
 


Old
  Post #12 (permalink)   02-18-2012, 09:53 AM
HD Newbie
 
Join Date: Jan 2012
Posts: 23

Status: moduleserver is offline
Yess it is !

Quote:
Originally Posted by backhost View Post
is analytics the best tracking software out there?
 
 
 
Reply

Thread Tools

New Post New Post   Old Post Old Post
Posting Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Sponsored By: