Skip to content

Instantly share code, notes, and snippets.

@greatislander
Created August 20, 2013 22:51
Show Gist options
  • Save greatislander/6288348 to your computer and use it in GitHub Desktop.
Save greatislander/6288348 to your computer and use it in GitHub Desktop.
Only display analytics code (Google Analytics, GoSquared, etc.) if you are on your production site as opposed to dev or staging.
<?php $production = ( site_url() == 'http://myproductionsite.com' ) ? true : false; // no trailing slash
if ( $production == true && !is_user_logged_in() ) {
// Put your analytics code here.
} ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment