google analytics code

Page 1 of 1

4 Replies - 1237 Views - Last Post: 23 December 2009 - 10:40 PM

#1 sudhakararaog  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 65
  • Joined: 14-August 09

google analytics code

Posted 23 December 2009 - 03:49 PM

is it a good idea to place the google analytics javascript code at the very bottom of the page just before
</body>



or should it be within the
<head> and </head>

Is This A Good Question/Topic? 0
  • +

Replies To: google analytics code

#2 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1868
  • View blog
  • Posts: 20,280
  • Joined: 17-March 01

Re: google analytics code

Posted 23 December 2009 - 03:59 PM

I recommend putting it at the bottom.
Was This Post Helpful? 0
  • +
  • -

#3 sudhakararaog  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 65
  • Joined: 14-August 09

Re: google analytics code

Posted 23 December 2009 - 10:15 PM

i am working on a static website which is hosted on linux and php and mysql. i am creating the html and css part of the website

all the pages in the website have a common section for example top portion has header links and bottom has footer links

so i thought it would be a good idea to have header.php and header.php that way any change that needs to be done can be done to these 2 files instead of changing all the files in the website

about the google analytics code after getting your response i want to add this google analytics code at the bottom of every page just before </body> tag this way each page's statistic details can be viewed by logging into google account


however since i want to have footer.php i want to include the footer links and then the google analytics code followed by </body></html> in footer.php

my question is if i were to do it this way, when google analytics javascript code which is only in 1 file footer.php though this file will be called in all other pages(about.php, services.php...) of the website as
include("footer.php");

will the analytics code still analyse traffic information for each and every page of the website(index.php, about.php, services.php ...)

please advice

thanks
Was This Post Helpful? 0
  • +
  • -

#4 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5226
  • View blog
  • Posts: 27,000
  • Joined: 10-May 07

Re: google analytics code

Posted 23 December 2009 - 10:34 PM

Because Javascript executes on the clients browser, everything will run as it should.

The server will execute the php code, & then deliver a perfectly viewable html file for the clients browser. To my knowledge, using php to build the code dynamically does not change any of the functionality between Javascript & the Google code that it executes.
Was This Post Helpful? 0
  • +
  • -

#5 sudhakararaog  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 65
  • Joined: 14-August 09

Re: google analytics code

Posted 23 December 2009 - 10:40 PM

thanks for replying

does this mean that by having analytics code in footer.php each page in the website will be analysed individually if the analytics code were to be in each of the files at the very bottom.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1