Fathom Analytics Fathom Analytics

Ignoring stats from your localhost

If you work on your website locally (i.e. localhost or sitename.local, etc) or want to ignore stats from a specific URL, you can ignore them in Fathom. For example, if you wanted to ignore localhost and web.archive.org, you'd use the following code (changing SITEID to your own Site ID):

<!-- Fathom - simple website analytics - https://usefathom.com -->
<script>
    (function(f, a, t, h, o, m){
      a[h]=a[h]||function(){
       (a[h].q=a[h].q||[]).push(arguments)
    };
    o=f.createElement('script'),
    m=f.getElementsByTagName('script')[0];
    o.async=1; o.src=t; o.id='fathom-script';
    m.parentNode.insertBefore(o,m)
    })(document, window, '//cdn.usefathom.com/tracker.js', 'fathom');
    fathom('set', 'siteId', 'SITEID');

    var fathomExcludeHostnames = [
    'localhost',
    'web.archive.org'
    ];

    if (fathomExcludeHostnames.indexOf(window.location.hostname) === -1) {
        fathom('trackPageview');
    }
</script>
<!-- / Fathom -->

If you wanted to ignore your local website and you used the URL mysite.local, you'd update the code to:

var fathomExcludeHostnames = [
    'mysite.local'
];

If you wanted to ignore referrals from site1.com, site1.com, and site1.com you'd update the code to:

var fathomExcludeHostnames = [
    'site1.com',
    'site2.com',
    'site3.com'
];
← Return to support