4 ms·
What would be the reason for this: // analytics disable if url contains underscore try { if(window.location.href.indexOf('_') > 0) {window['ga-disable-UA-20
by cookiemonsta 10y ago
What would be the reason for this:
// analytics disable if url contains underscore
try {
if(window.location.href.indexOf('_') > 0) {window['ga-disable-UA-20753548-1'] = true;}
} catch(e) {}
});
- robotnoises 10y agoMy guess is that there is a test scenario in which they don't want google analytics to load?
- mpeg 10y agoIt seems like they store files (presumably both internal and public) under https://www.nsa.gov/ia/_files/ https://www.nsa.gov/ia/_files/ so I guess it's the way they represent their non-indexable urls.
- gizmo 10y agoThe if condition is wrong. This is why functions like indexOf should return a tuple of a boolean and an offset instead of encoding "not found" by returning -1.
- ChristianBundy 10y agoThe if condition should use >= rather than >, but it otherwise makes sense.
- dahart 10y agoI'm not arguing in favor of writing it that way, but I might argue it's not incorrect as written. location.href can never start with an underscore. A regex on location.pathname would sure be a lot clearer to read, though.