analytics tracking with php website -


I recently changed the format of my website to PHP (rather than HTML), that is, I have changed all of my HTML pages together. Fixed link with .php extension and my .htaccess file

I need to track my new php pages with Google Analytics, so I created a separate php file with Google's JavaScript snippet. & lt; Body & gt; Tags:

  & lt; After php, I put it on the root of my website and linked to this code from every php tag of my code Include_once ("analyticstracking.php")? & Gt;   

My problem is that it only works with my index.php page. All my other pages can not be found in the analyticstracking.php (in the Dreamware it says, "Analytic Stacking.fp" is not on the local disk.) "Go")

If I Link by adding "/"):

  & lt ;? php include_once ("/ analyticstracking.php")? & Gt;   

Then my All pages can find the file but Google Analytics does not appear to track my activity.

I use "Analytics - real time" to test this.

Here's my URL: www.brp-architects.com. (Currently

  & lt ;? php include_once ("/ analyticstracking.php")? As a code using this code, "/" allows all of my pages to locate my tracking code php file).  

I am completing this, so I can use the PHP code snippet to retrieve the IP address of my website visitors by following the proxy server. Ip:

  & lt; ? If (getenv (HTTP_X_FORWARDED_FOR)) {$ ip_address = getenv (HTTP_X_FORWARDED_FOR); } And {$ ip_address = getenv (REMOTE_ADDR); }   

?

Thank you for your responses!

Analytic tracking is my tracking snippet from. Php file:

  & lt; Script type = "text / javascript" & gt; Var _gaq = _gaq || []; _gaq.push (['_ setAccount', 'UA-5434 990-2']); _gaq.push (['_ trackPageview']); SetTimeout ('_gaq.push ([\' _ trackEvent \ ',' NoBounce ',' more than 30 seconds']), 30000); (Function () {var ga = document.createElement ('script'); ga.type = 'text / javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol? 'Http: //ssl': 'http: // www') + '.google-analytics.com / ga.js'; var s = document.getElementsByTagName ('script') [0]; s.parentNode.insertBefore (GA, S);}) (); & Lt; / Script & gt;   

The link to my tracking code is directly under the initial body tag:

  & lt ;? Php include_once ("/ analyticstracking.php")? & Gt;    

If it works on index.php Then the script analyticstracking.php is okay.

What could be the reason for you to include it on other scripts.

Just make sure the path of that script is correct on other scripts.
To ensure that please include: Include ($ _ server ['DOCUMENT_ROOT']. 'Pat-to-Script / Analytics Tracking. FP');

Comments