singapore: the smallest big galery
home » forum » General » Google Analytics script

You are not logged in.

#1 2010-05-10 01:35:24

edh
Member

Google Analytics script

I want to use Google Analytics to see web site statistics.  I would like to see stats on my singapore photo gallery also. 

In order to get Google Analytics to start tracking my web stats  I have to put a short 4 line javascript before the <body> tag on each page.

Singapore seems to be mainly PHP and include files.

1) Can I put this short javascript script into one of the includes so that it will be before the <body> tag on each page in my photo gallery?  If so which one?
2) will the javascript play nice with the PHP?

Thanks,

Ed.

Offline

 

#2 2010-05-10 08:25:47

andyash
Member

Re: Google Analytics script

1. You should add this script before the <body> tag inside your template's header.php file.

2. PHP has no issues with javascript.

Offline

 

#3 2010-05-15 04:50:52

edh
Member

Re: Google Analytics script

Thank you, worked great!

In case anyone else wants to try google analytics.  It is a really great free web statistics tracking tool. Tracks visits, pageviews, keywords, and a lot lot more.

  Here are the three steps I did:

1) Created an include file called google_analytics_include.php  you can name it whatever.

2) put my own personal google analytics script that google provided me when I signed up at www.google.com/analytics inside of the include file:

<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'XX-xxxxxxxx']);
  ...
  ...
</script><!-- ======  Google Analytics script include end  =====  -->

3) inserted this line just before the <body> tag inside of my template header.tpl.php file

<?php include("templates/google_analytics_include.php"); ?>

Ed

Offline

 

#4 2010-08-27 01:45:44

allan60
Member

Re: Google Analytics script

You can put your google code analytics at the footer script of your website since you are using php. You don't need to put it in every pages of your website.

Offline

 

#5 2010-12-14 06:48:59

Blair
Member

Re: Google Analytics script

I used Google analytic script for some short time to check traffic source ......

Offline

 

#6 2011-01-05 11:47:43

shane
Member

Re: Google Analytics script

it does not matter you can use it with php also....

Offline

 

#7 2011-02-28 05:13:30

alexsmth114
Member

Re: Google Analytics script

(it does not matter you can use it with php also...)
You are absolutely right, I agree with you!!..

Offline