function isTracker (urlToCheck, thisTab, request) {
    let currLocation = thisTab.url || ''
    let siteDomain = thisTab.site ? thisTab.site.domain : ''
    if (!siteDomain) return

    // DEMO embedded tweet option
    // a more robust test for tweet code may need to be used besides just
    // blocking platform.twitter.com
    if (settings.getSetting('embeddedTweetsEnabled') === false) {
        if (/platform.twitter.com/.test(urlToCheck)) {
            console.log('blocking tweet embedded code on ' + urlToCheck)
            return {parentCompany: 'Twitter', url: 'platform.twitter.com', type: 'Analytics'}
        }
    }

    if (settings.getSetting('trackerBlockingEnabled')) {
        let parsedUrl = tldjs.parse(urlToCheck)
        let hostname

        if (parsedUrl && parsedUrl.hostname) {
            hostname = parsedUrl.hostname
        } else {
            // fail gracefully if tldjs chokes on the URL e.g. it doesn't parse
            // if the subdomain name has underscores in it
            try {
                // last ditch attempt to try and grab a hostname
                // this will fail on more complicated URLs with e.g. ports
                // but will allow us to block simple trackers with _ in the subdomains
                hostname = urlToCheck.match(/^(?:.*:\/\/)([^/]+)/)[1]
            } catch (e) {
                // give up
                return false
            }
        }

        let urlSplit = hostname.split('.')

        var whitelistedTracker = checkWhitelist(urlToCheck, siteDomain, request)
        if (whitelistedTracker) {
            let commonParent = getCommonParentEntity(currLocation, urlToCheck)
            if (commonParent) {
                return addCommonParent(whitelistedTracker, commonParent)
            }
            return whitelistedTracker
        }

        let surrogateTracker = checkSurrogateList(urlToCheck, parsedUrl, currLocation)
        if (surrogateTracker) {
            let commonParent = getCommonParentEntity(currLocation, urlToCheck)
            if (commonParent) {
                return addCommonParent(surrogateTracker, commonParent)
            }
            return surrogateTracker
        }

        // Look up trackers by parent company. This function also checks to see if the poential
        // tracker is related to the current site. If this is the case we consider it to be the
        // same as a first party requrest and return
        let trackerByParentCompany = checkTrackersWithParentCompany(urlSplit, siteDomain, request)
        if (trackerByParentCompany) {
            let commonParent = getCommonParentEntity(currLocation, urlToCheck)
            if (commonParent) {
                return addCommonParent(trackerByParentCompany, commonParent)
            }
            return trackerByParentCompany
        }
    }
    return false
}
/*
 * The main parts of the isTracker algo looks like this:
 * 1. check the request against our own whitelist
 * 2. check the request against the trackersWithParentCompany list
 * 3. check the request against the easylists
 *
 * If a tracker is found in steps #2,3 we check it against getCommonParentEntity
 * to determine if this tracker is owned by the current site's parent company.
 * In this case we don't block the request but still return the tracker obj
 * for transparency.
 */
The main parts of the isTracker algo looks like this:
1. check the request against our own whitelist
2. check the request against the trackersWithParentCompany list
3. check the request against the easylists

If a tracker is found in steps #2,3 we check it against getCommonParentEntity
to determine if this tracker is owned by the current site's parent company.
In this case we don't block the request but still return the tracker obj
for transparency.
The main parts of the isTracker algo looks like this : 1 . check the request against our own whitelist 2 . check the request against the trackersWithParentCompany list 3 . check the request against the easylists If a tracker is found in steps #2 3 we check it against getCommonParentEntity to determine if this tracker is owned by the current site ' s parent company . In this case we don ' t block the request but still return the tracker obj for transparency .
function isTracker (urlToCheck, thisTab, request) {
    let currLocation = thisTab.url || ''
    let siteDomain = thisTab.site ? thisTab.site.domain : ''
    if (!siteDomain) return
    if (settings.getSetting('embeddedTweetsEnabled') === false) {
        if (/platform.twitter.com/.test(urlToCheck)) {
            console.log('blocking tweet embedded code on ' + urlToCheck)
            return {parentCompany: 'Twitter', url: 'platform.twitter.com', type: 'Analytics'}
        }
    }
    if (settings.getSetting('trackerBlockingEnabled')) {
        let parsedUrl = tldjs.parse(urlToCheck)
        let hostname
        if (parsedUrl && parsedUrl.hostname) {
            hostname = parsedUrl.hostname
        } else {
            try {
                hostname = urlToCheck.match(/^(?:.*:\/\/)([^/]+)/)[1]
            } catch (e) {
                return false
            }
        }
        let urlSplit = hostname.split('.')
        var whitelistedTracker = checkWhitelist(urlToCheck, siteDomain, request)
        if (whitelistedTracker) {
            let commonParent = getCommonParentEntity(currLocation, urlToCheck)
            if (commonParent) {
                return addCommonParent(whitelistedTracker, commonParent)
            }
            return whitelistedTracker
        }
        let surrogateTracker = checkSurrogateList(urlToCheck, parsedUrl, currLocation)
        if (surrogateTracker) {
            let commonParent = getCommonParentEntity(currLocation, urlToCheck)
            if (commonParent) {
                return addCommonParent(surrogateTracker, commonParent)
            }
            return surrogateTracker
        }
        let trackerByParentCompany = checkTrackersWithParentCompany(urlSplit, siteDomain, request)
        if (trackerByParentCompany) {
            let commonParent = getCommonParentEntity(currLocation, urlToCheck)
            if (commonParent) {
                return addCommonParent(trackerByParentCompany, commonParent)
            }
            return trackerByParentCompany
        }
    }
    return false
}
function isTracker ( urlToCheck , thisTab , request ) { let currLocation = thisTab . url || '' let siteDomain = thisTab . site ? thisTab . site . domain : '' if ( ! siteDomain ) return if ( settings . getSetting ( 'embeddedTweetsEnabled' ) === false ) { if ( / platform.twitter.com / . test ( urlToCheck ) ) { console . log ( 'blocking tweet embedded code on ' + urlToCheck ) return { parentCompany : 'Twitter' , url : 'platform.twitter.com' , type : 'Analytics' } } } if ( settings . getSetting ( 'trackerBlockingEnabled' ) ) { let parsedUrl = tldjs . parse ( urlToCheck ) let hostname if ( parsedUrl && parsedUrl . hostname ) { hostname = parsedUrl . hostname } else { try { hostname = urlToCheck . match ( / ^(?:.*:\/\/)([^/]+) / ) [ 1 ] } catch ( e ) { return false } } let urlSplit = hostname . split ( '.' ) var whitelistedTracker = checkWhitelist ( urlToCheck , siteDomain , request ) if ( whitelistedTracker ) { let commonParent = getCommonParentEntity ( currLocation , urlToCheck ) if ( commonParent ) { return addCommonParent ( whitelistedTracker , commonParent ) } return whitelistedTracker } let surrogateTracker = checkSurrogateList ( urlToCheck , parsedUrl , currLocation ) if ( surrogateTracker ) { let commonParent = getCommonParentEntity ( currLocation , urlToCheck ) if ( commonParent ) { return addCommonParent ( surrogateTracker , commonParent ) } return surrogateTracker } let trackerByParentCompany = checkTrackersWithParentCompany ( urlSplit , siteDomain , request ) if ( trackerByParentCompany ) { let commonParent = getCommonParentEntity ( currLocation , urlToCheck ) if ( commonParent ) { return addCommonParent ( trackerByParentCompany , commonParent ) } return trackerByParentCompany } } return false }
The main parts of the isTracker algo looks like this:
 1. check the request against our own whitelist
 2. check the request against the trackersWithParentCompany list
 3. check the request against the easylists
The main parts of the isTracker algo looks like this : 1 . check the request against our own whitelist 2 . check the request against the trackersWithParentCompany list 3 . check the request against the easylists
// DEMO embedded tweet option // a more robust test for tweet code may need to be used besides just // blocking platform.twitter.com // fail gracefully if tldjs chokes on the URL e.g. it doesn't parse // if the subdomain name has underscores in it // last ditch attempt to try and grab a hostname // this will fail on more complicated URLs with e.g. ports // but will allow us to block simple trackers with _ in the subdomains // give up // Look up trackers by parent company. This function also checks to see if the poential // tracker is related to the current site. If this is the case we consider it to be the // same as a first party requrest and return