Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save patrickgilmour/9d81e4205ea6df144d0d to your computer and use it in GitHub Desktop.

Select an option

Save patrickgilmour/9d81e4205ea6df144d0d to your computer and use it in GitHub Desktop.

Revisions

  1. patrickgilmour revised this gist Jul 7, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions google_analytics_exclude_local.js
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,7 @@
    // Replace MYLIVEDOMAIN.com with your domain.
    // Google Analytics will now not receive hits from cloned development versions of your site on localhost etc.
    // Also checkout `Block Yourself from Analytics` plugin for Chrome
    // see also: http://stackoverflow.com/questions/1251922/is-there-a-way-to-stop-google-analytics-counting-development-work-as-hits

    if (document.location.hostname.search("MYLIVEDOMAIN.com") !== -1) {

  2. patrickgilmour created this gist Jul 7, 2014.
    13 changes: 13 additions & 0 deletions google_analytics_exclude_local.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    <script>

    // Replace MYLIVEDOMAIN.com with your domain.
    // Google Analytics will now not receive hits from cloned development versions of your site on localhost etc.
    // Also checkout `Block Yourself from Analytics` plugin for Chrome

    if (document.location.hostname.search("MYLIVEDOMAIN.com") !== -1) {

    /* Google Analytics Code here */

    }

    </script>