Introduce query string parameter "firstVersion" in filter list downloads
Background
This is a follow up on trac #7168.
?firstVersion=
for notification.json
downloads has landed recently and is working well. Our first (preliminary) analyses are very promising DATA-31, DATA-34!
In the meantime, during working on improved counting methods #21928, we encountered discrepancies in resource downloads #25083 and opt-out numbers #21928-comments that we need to investigate further. ?firstVersion=
for notification.json
already gave us important first insight, but without firstVersion
for exceptionrules.txt
we cannot complete the investigation.
This is a major blocker for creating a counting method that yields higher absolute numbers which would be beneficial for eyeo financially as well as PR wise.
What to change
Add ?firstVersion=
parameter (as described in trac #7168) to filter list download query string parameters as well.
The design must be as follows:
- Move all the code related to trac #7168 into a new file
lib/analytics.js
-
Prefs.analytics.trustedHosts = []
must be an array containing the hosts to which to send the?firstVersion=
parameter - The data should be stored in
Prefs.analytics.data = {}
:Prefs.analytics.data.firstVersion
should be the value of the first downloaded version (with or without the-E
suffix), andPrefs.analytics.data.currentVersion
should be the value of the last downloaded version (of the last downloaded resource) -
?firstVersion=
should be sent only if the original URL's host is inPrefs.analytics.trustedHosts
, regardless of any redirects (i.e. it should not be sent to redirect URLs); when a new version value is received, it should be considered only if the source (original or redirect) URL's host is inPrefs.analytics.trustedHosts
- eyeo/adblockplus/adblockpluschrome> will have to include some migration code (see integration notes), which can be removed after a few releases
- To check whether it is an existing installation (for the
-E
suffix), let's continue to use"data" in Prefs.notificationdata
Integration notes
eyeo/adblockplus/adblockpluschrome> must set a new preference value Prefs.analytics = {trustedHosts: ["notification.adblockplus.org", "easylist-downloads.adblockplus.org"]}
in lib/prefs.js
On startup, if Prefs.analytics.data
does not exist (i.e. !("data" in Prefs.analytics)
) and Prefs.notificationdata.firstVersion
does exist and is not "0"
:
- Move
Prefs.notificationdata.firstVersion
toPrefs.analytics.data.firstVersion
- Copy
Prefs.notificationdata.data.version
toPrefs.analytics.data.currentVersion
Hints for testers
Repeat the tests from trac #7168, but this time expect the ?firstVersion=
query string parameter to be passed to both https://notification.adblockplus.org/notification.json and any filter list hosted on the domain easylist-downloads.adblockplus.org
.
The value of the ?firstVersion=
parameter may be based on the value in notification.json
or in a filter list's !Version:
special comment, whichever arrives first on the client.
For the upgrade scenario, test both upgrading from Adblock Plus 3.6 and upgrading from Adblock Plus 3.7.
Follow-up tickets
See #102.