Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-1798: Update Unknown category to include Ad Blocker unknowns #433

Merged
merged 10 commits into from Aug 2, 2019

Add unknownTrackerCount to adBlock in reducer in case it's needed later

  • Loading branch information
Eden12345 committed Jul 31, 2019
commit 8a2289b29b00ae3a6fdd5c0faa8d4a442c3cb515
@@ -43,7 +43,7 @@ const initialState = {
antiTracking: {
totalUnsafeCount: 0, // The amount of data points scrubbed by Anti-Tracking
totalUnknownCount: 0, // The amount of data points scrubbed by Anti-Tracking for Trackers not in the Ghostery DB
unknownTrackerCount: 0, // The amount of trackers blocked by Anti-Tracking
unknownTrackerCount: 0, // The amount of unknown trackers scrubbed by Anti-Tracking (which are each associated with 1 or more data points)
unknownTrackers: [], // An array of objects associated with each unknown Tracker (includes both blocked and whitelisted trackers for this site)
whitelistedUrls: {}, // An object of whitelisted url domains pointing to an object with the associated tracker name and an array of whitelisted host domains
hide: false, // Whether or not to display the Anti-Tracking blocking category
@@ -39,11 +39,11 @@ const initialState = {
antiTracking: {
totalUnsafeCount: 0, // The amount of data points scrubbed by Anti-Tracking
totalUnknownCount: 0, // The amount of data points scrubbed by Anti-Tracking for Trackers not in the Ghostery DB
unknownTrackerCount: 0, // The amount of trackers blocked by Anti-Tracking
unknownTrackerCount: 0, // The amount of unknown trackers scrubbed by Anti-Tracking (which are each associated with 1 or more data points)
},
adBlock: {
totalCount: 0, // The amount of ads blocked by Ad Blocking
trackerCount: 0, // The amount of trackers blocked by Ad Blocking (which are each associated with 1 or more ads)
unknownTrackerCount: 0, // The amount of unknown trackers blocked by Ad Blocking (which are each associated with 1 or more ads)
}
};
/**
@@ -100,24 +100,16 @@ export function getCliqzAdBlockingCount(tabId) {
if (!conf.enable_ad_block || !adblocker.background) {
return {
totalCount: 0,
trackerCount: 0,
unknownTrackerCount: 0,
};
}

const adBlockInfo = adblocker.background.actions.getAdBlockInfoForTab(tabId);

if (!adBlockInfo) {
return {
totalCount: 0,
trackerCount: 0,
};
}

console.log('~~~sawgferw~~~', adBlockInfo)
const { others } = adblocker.background.actions.getGhosteryStats(tabId);

return {
totalCount: adBlockInfo.totalCount,
trackerCount: Object.keys(adBlockInfo.advertisersList).length,
totalCount: adBlockInfo ? adBlockInfo.totalCount : 0,
unknownTrackerCount: others ? Object.keys(others).length : 0,
};
}

@@ -147,7 +139,7 @@ export function getCliqzGhosteryBugs(tabId) {
* @param {Function} callback
*/
export function sendCliqzModuleCounts(tabId, tabHostUrl, callback) {
const modules = { adblock: {}, antitracking: {} };
const modules = { adblock: {}, antiTracking: {} };

modules.adblock = getCliqzAdBlockingCount(tabId);
modules.antiTracking = getCliqzAntiTrackingData(tabId, tabHostUrl);
ProTip! Use n and p to navigate between commits in a pull request.