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 920405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:42:27+00:00 2026-05-15T18:42:27+00:00

EDIT: This question is solved, but I can’t accept my own answer just yet.

  • 0

EDIT: This question is solved, but I can’t accept my own answer just yet.

Howdy!

So I’ve got a PHP/CodeIgniter webapp. I’ve got some custom Ajax-based tracking code inserted into my page – however obviously, for testing purposes, I don’t want this code to fire when I’m running the site locally on my development computer.

In order to avoid Analytics still tracking, I’m using this in my source code:

<?php if ($_SERVER['HTTP_HOST'] != 'localhost:8888'){ ?>
    _gaq.push(['_trackPageview', '/my/ajax/page']);
<?php } ?>

That does the job fine in the source code – when I’m on http://localhost:8888 (MAMP’s URL) it doesn’t appear. When I’m running live, it appears. Woot.

However I’ve found some seemingly infinite error. When you click a link that fires an Ajax event, the Firebug log repeatedly fills up and up and up with errors, if you leave it a couple of minutes it gets into the thousands (I guess it’s an infinite loop). The error each time is:

_gaq is not defined

Then it references it being on localhost:8888 (line 26). Line 26 reads:

<!-- Includes for Uniform JS -->

Just a comment… I’ve removed that (and the subsequent Uniform JS script links beneath), same error, just goes to the next possible line. So I thought it might be the script above causing it the problem, that was Typekit. Commented out Typekit, still the same issue. Ouch.

Anybody know what’s going wrong here?

*Could I just forget the PHP blocking bit and can I block my localhost in Google Analytics? The problem is I’m on a dynamic IP so changing Analytics settings every time my computer gets switched on will be a pain in the bum *.

Thanks!

Jack

EDIT: I should make it clear that EVERY reference to Google Analytics is put between the <?php ?> blocks, including the declaration at the foot of the page. So it’s not like there’s some Analytics JS appearing and not the rest.

  • 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-05-15T18:42:28+00:00Added an answer on May 15, 2026 at 6:42 pm

    Problem solved. Thanks to everyone who read this question and considered answers for me.

    It was a pretty easy one:

    <?php if ($_SERVER['HTTP_HOST'] == 'localhost:8888') { ?>
    

    Turns out I’d written == by mistake, instead of != on one occurrence of the PHP block!

    Oops, Thanks!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: I solved it seconds after posting the question (sorry!) but can't accept an
THIS QUESTION IS SOLVED — can't post an answer to my own question on
I Can't answer my own question yet, so here is the answer I'm an
edit This question is solved! Having something weird. I'm using html { font-size: 100%
Edit: I solved it somehow with PHP. Its so specific but I want to
Edit: this question is outdated. The jsonlite package flattens automatically. I am dealing with
Edit This question has gone through a few iterations by now, so feel free
EDIT: This question is a duplicate of What is the difference between managed and
EDIT: This question was initially too general, I think. So What I really need
EDIT: This question is about finding definitive reference to MySQL syntax on SELECT modifying

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.