Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8207711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:05:03+00:00 2026-06-07T09:05:03+00:00

I have recently changed my website format to php (rather than html), i.e. I

  • 0

I have recently changed my website format to php (rather than html), i.e. I have renamed all of my HTML pages with a .php extension and fixed the links with my .htaccess file.

I need to track my new php pages with Google analytics, so I created a separate php file containing Google’s javascript snippet. I placed it at the root of my website and linked each of my php tags to it with this code after the <body> tag:

<?php include_once("analyticstracking.php") ?>

My problem is that this only appears to be working with my index.php page. All my other pages cannot find analyticstracking.php (in Dreamweaver it says “‘analyticstracking.php’ is not on the local disk. Get”)

If I change the link (by adding “/”) to:

<?php include_once("/analyticstracking.php") ?>

then all my pages can locate the file but google analytics doesn’t appear to track my activity.

I am using “Analytics – Real Time” to test this.

Here is my url http://www.brp-architects.com.
(Currently using

<?php include_once("/analyticstracking.php") ?>

as this code, with the “/”, allows all my pages to locate my tracking code php file).

The whole reason I am doing this is so I can use a snippet of PHP code to retrieve my website visitor’s IP addresses by getting behind the proxy servers ip:

<?
if (getenv(HTTP_X_FORWARDED_FOR)) {
    $ip_address = getenv(HTTP_X_FORWARDED_FOR);
} else {
    $ip_address = getenv(REMOTE_ADDR);
}

?>

Thanks for your responses!

Here is my tracking snippet from the analyticstracking.php file:

<script type="text/javascript">

var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-5434990-2']);
  _gaq.push(['_trackPageview']);
  setTimeout('_gaq.push([\'_trackEvent\', \'NoBounce\', \'Over 30 seconds\'])',30000);

(function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

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

<?php include_once("/analyticstracking.php") ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T09:05:04+00:00Added an answer on June 7, 2026 at 9:05 am

    If it works on index.php, then the analyticstracking.php script is fine.

    What could cause this is the way you include this on other Scripts.

    Just make sure the path of that script is correct on other Scripts.
    To be sure include like this :

    include($_SERVER['DOCUMENT_ROOT'].'PATH-TO-SCRIPT/analyticstracking.php');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

have recently changed the url structure of my website and have added a few
I have a website http://rochesterwaterskishow.com which they've recently changed their name so they want
We have Josso authentication on our website and recently we changed the mysql server
We have recently changed our website configuration to make certain fields mandatory. We also
I have a classified website, and I recently changed the insertion of classifieds to
I recently changed the filename of some of my pages. For example work1.html to
I have recently changed my web app to create a database connection per command
I recently changed my password and have to change my maven settings.xml file to
I was recently trying to re-install the fos:userbundle and noticed the docs have changed.
I have recently had a linux server compromised from bots uploading .php scripts and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.