Index: lib/notification.js
diff --git a/lib/notification.js b/lib/notification.js
index 311e4e881389424155f1a61a3c351a3f69cfaf88..c499b30da0eecba90b62b0b6c8738dcf4c56264e 100644
--- a/lib/notification.js
+++ b/lib/notification.js
@@ -200,17 +200,6 @@ let Notification = exports.Notification =
    */
   _getNextToShow(url)
   {
-    function checkTarget(target, parameter, name, version)
-    {
-      let minVersionKey = parameter + "MinVersion";
-      let maxVersionKey = parameter + "MaxVersion";
-      return !((parameter in target && target[parameter] != name) ||
-               (minVersionKey in target &&
-                Services.vc.compare(version, target[minVersionKey]) < 0) ||
-               (maxVersionKey in target &&
-                Services.vc.compare(version, target[maxVersionKey]) > 0));
-    }
-
     let remoteData = [];
     if (typeof Prefs.notificationdata.data == "object" &&
         Prefs.notificationdata.data.notifications instanceof Array)
@@ -224,6 +213,30 @@ let Notification = exports.Notification =
 
     const {addonName, addonVersion, application,
            applicationVersion, platform, platformVersion} = require("info");
+
+    let targetChecks = {
+      extension: v => v == addonName,
+      extensionMinVersion:
+        v => Services.vc.compare(addonVersion, v) >= 0,
+      extensionMaxVersion:
+        v => Services.vc.compare(addonVersion, v) <= 0,
+      application: v => v == application,
+      applicationMinVersion:
+        v => Services.vc.compare(applicationVersion, v) >= 0,
+      applicationMaxVersion:
+        v => Services.vc.compare(applicationVersion, v) <= 0,
+      platform: v => v == platform,
+      platformMinVersion:
+        v => Services.vc.compare(platformVersion, v) >= 0,
+      platformMaxVersion:
+        v => Services.vc.compare(platformVersion, v) <= 0,
+      blockedTotalMin: v => Prefs.show_statsinpopup &&
+        Prefs.blocked_total >= v,
+      blockedTotalMax: v => Prefs.show_statsinpopup &&
+        Prefs.blocked_total <= v,
+      locales: v => v.includes(Utils.appLocale)
+    };
+
     let notificationToShow = null;
     for (let notification of notifications)
     {
@@ -289,19 +302,21 @@ let Notification = exports.Notification =
       if (notification.targets instanceof Array)
       {
         let match = false;
+
         for (let target of notification.targets)
         {
-          if (checkTarget(target, "extension", addonName, addonVersion) &&
-              checkTarget(target, "application", application,
-                          applicationVersion) &&
-              checkTarget(target, "platform", platform, platformVersion))
+          if (Object.keys(target).every(key =>
+              targetChecks.hasOwnProperty(key) &&
+              targetChecks[key](target[key])))
           {
             match = true;
             break;
           }
         }
         if (!match)
+        {
           continue;
+        }
       }
 
       if (!notificationToShow ||
Index: test/notification.js
diff --git a/test/notification.js b/test/notification.js
index 4a5bc61d1baf99953c245d4441cb02c09944d909..ab673ca7f3cb598ef616179d886ccdbcc64d8da8 100644
--- a/test/notification.js
+++ b/test/notification.js
@@ -140,6 +140,30 @@ exports.testNoType = function(test)
   }).catch(unexpectedError.bind(test)).then(() => test.done());
 };
 
+function testTargetSelectionFunc(propName, value, result)
+{
+  return function(test)
+  {
+    let targetInfo = {};
+    targetInfo[propName] = value;
+
+    let information = {
+      id: 1,
+      type: "information",
+      message: {"en-US": "Information"},
+      targets: [targetInfo]
+    };
+
+    registerHandler.call(this, [information]);
+    this.runScheduledTasks(1).then(() =>
+    {
+      let expected = (result ? [information] : []);
+      test.deepEqual(showNotifications(), expected, "Selected notification for " + JSON.stringify(information.targets));
+      test.deepEqual(showNotifications(), [], "No notification on second call");
+    }).catch(unexpectedError.bind(test)).then(() => test.done());
+  };
+}
+
 exports.testTargetSelection = {};
 
 for (let [propName, value, result] of [
@@ -174,29 +198,40 @@ for (let [propName, value, result] of [
   ["platformMaxVersion", "12.0", true],
   ["platformMaxVersion", "12", true],
   ["platformMaxVersion", "13", true],
-  ["platformMaxVersion", "11", false]
+  ["platformMaxVersion", "11", false],
+  ["blockedTotalMin", "11", false],
+  ["blockedTotalMin", "10", true],
+  ["blockedTotalMax", "10", true],
+  ["blockedTotalMax", "1", false],
+  ["locales", ["en-US"], true],
+  ["locales", ["en-US", "de-DE"], true],
+  ["locales", ["de-DE"], false],
+  ["locales", ["en-GB", "de-DE"], false]
 ])
 {
-  exports.testTargetSelection[`${propName}=${value}`] = function(test)
-  {
-    let targetInfo = {};
-    targetInfo[propName] = value;
+  exports.testTargetSelection[`${propName}=${value}`] = testTargetSelectionFunc(propName, value, result);
+}
 
-    let information = {
-      id: 1,
-      type: "information",
-      message: {"en-US": "Information"},
-      targets: [targetInfo]
-    };
+exports.testTargetSelectionNoShowStats = {
 
-    registerHandler.call(this, [information]);
-    this.runScheduledTasks(1).then(() =>
-    {
-      let expected = (result ? [information] : []);
-      test.deepEqual(showNotifications(), expected, "Selected notification for " + JSON.stringify(information.targets));
-      test.deepEqual(showNotifications(), [], "No notification on second call");
-    }).catch(unexpectedError.bind(test)).then(() => test.done());
-  };
+  setUp(callback)
+  {
+    this.show_statsinpopup_orig = Prefs.show_statsinpopup;
+    Prefs.show_statsinpopup = false;
+    callback();
+  },
+  tearDown(callback)
+  {
+    Prefs.show_statsinpopup = this.show_statsinpopup_orig;
+    callback();
+  }
+};
+for (let [propName, value, result] of [
+  ["blockedTotalMin", "10", false],
+  ["blockedTotalMax", "10", false]
+])
+{
+  exports.testTargetSelectionNoShowStats[`${propName}=${value}`] = testTargetSelectionFunc(propName, value, result);
 }
 
 exports.testMultipleTargets = {};
@@ -213,7 +248,8 @@ for (let [[propName1, value1, result1], [propName2, value2, result2]] of pairs([
   ["platform", "chromium", true],
   ["platform", "gecko", false],
   ["platformMinVersion", "12", true],
-  ["platformMinVersion", "13", false]
+  ["platformMinVersion", "13", false],
+  ["unkown", "unknown", false]
 ]))
 {
   exports.testMultipleTargets[`${propName1}=${value1},${propName2}=${value2}`] = function(test)
Index: test/stub-modules/prefs.js
diff --git a/test/stub-modules/prefs.js b/test/stub-modules/prefs.js
index 2925a1385d4a4bc87b64a299ad363f8f30315286..fbddb852a3eb93eb826999f89e6a29716710b572 100644
--- a/test/stub-modules/prefs.js
+++ b/test/stub-modules/prefs.js
@@ -10,7 +10,9 @@ let Prefs = exports.Prefs = {
   subscriptions_fallbackurl: "",
   notificationurl: "http://example.com/notification.json",
   notificationdata: {},
-  notifications_ignoredcategories: []
+  notifications_ignoredcategories: [],
+  blocked_total: 10,
+  show_statsinpopup: true
 };
 
 for (let key of Object.keys(Prefs))
Index: test/stub-modules/utils.js
diff --git a/test/stub-modules/utils.js b/test/stub-modules/utils.js
index 7bebe506c5377332e5221c8447fbfffd15fe2534..32bb627eca80329cba29ba62fb3072584f6ab3ad 100644
--- a/test/stub-modules/utils.js
+++ b/test/stub-modules/utils.js
@@ -3,6 +3,8 @@
 const crypto = require("crypto");
 
 exports.Utils = {
+  appLocale: "en-US",
+
   generateChecksum(lines)
   {
     let buffer = new Buffer(lines.join("\n"), "utf-8");
