Deskana has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/170285

Change subject: Migrate all app install IDs to be the same as the old reading 
action ID.
......................................................................

Migrate all app install IDs to be the same as the old reading action ID.

As per the meeting between Product and Analytics, we're migrating all app
install IDs in all app schemas to be the same, so that the tables can be
joined and overlap in users between features can be found.

This patch changes all app install IDs so that they're the same as the install
ID that was previously used for reading actions. That way, the analysis that's
generated on an ongoing basis by analytics will remain unchanged, whereas the
EventLogging data install IDs will all change, but simply go in to new tables.

Change-Id: I747cc77afa63442c98f55ea2851dbd89940a2407
---
M wikipedia/res/values/preference_keys.xml
M wikipedia/src/main/java/org/wikipedia/WikipediaApp.java
M wikipedia/src/main/java/org/wikipedia/analytics/AppearanceChangeFunnel.java
M wikipedia/src/main/java/org/wikipedia/analytics/SavedPagesFunnel.java
M wikipedia/src/main/java/org/wikipedia/analytics/SessionFunnel.java
M wikipedia/src/main/java/org/wikipedia/analytics/ToCInteractionFunnel.java
M wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java
M wikipedia/src/main/java/org/wikipedia/savedpages/RefreshSavedPageTask.java
M wikipedia/src/main/java/org/wikipedia/settings/PrefKeys.java
9 files changed, 33 insertions(+), 78 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/85/170285/1

diff --git a/wikipedia/res/values/preference_keys.xml 
b/wikipedia/res/values/preference_keys.xml
index f4b61a1..1cf70bf 100644
--- a/wikipedia/res/values/preference_keys.xml
+++ b/wikipedia/res/values/preference_keys.xml
@@ -13,9 +13,6 @@
     <string name="preference_key_feedback">send_feedback</string>
     <string name="preference_key_logout">log_out</string>
     <string 
name="preference_reading_app_install_id">readingAppInstallID</string>
-    <string 
name="preference_toc_app_install_id">ANALYTICS_APP_ID_FOR_ToC</string>
-    <string 
name="preference_saved_pages_app_install_id">ANALYTICS_APP_ID_FOR_SAVED_PAGES</string>
-    <string 
name="preference_sessions_app_install_id">ANALYTICS_APP_ID_FOR_SESSIONS</string>
     <string name="preference_onboard">onboard</string>
     <string name="preference_text_size_multiplier">textSizeMultiplier</string>
     <string name="preference_color_theme">colorTheme</string>
diff --git a/wikipedia/src/main/java/org/wikipedia/WikipediaApp.java 
b/wikipedia/src/main/java/org/wikipedia/WikipediaApp.java
index b82ad7d..33f2e5a 100644
--- a/wikipedia/src/main/java/org/wikipedia/WikipediaApp.java
+++ b/wikipedia/src/main/java/org/wikipedia/WikipediaApp.java
@@ -469,32 +469,11 @@
         return styleLoader;
     }
 
-    private String appInstallReadActionID;
-    public String getAppInstallReadActionID() {
-        appInstallReadActionID = 
getAppInstallIDForFeature(PrefKeys.getReadingAppInstallId());
-        Log.d("Wikipedia", "Read ID is" + appInstallReadActionID);
-        return appInstallReadActionID;
-    }
-
-    private String appInstallToCInteractionID;
-    public String getAppInstallToCInteractionID() {
-        appInstallToCInteractionID = 
getAppInstallIDForFeature(PrefKeys.getToCAppInstallId());
-        Log.d("Wikipedia", "ToC ID is" + appInstallToCInteractionID);
-        return appInstallToCInteractionID;
-    }
-
-    private String appInstallSavedPagesID;
-    public String getAppInstallSavedPagesID() {
-        appInstallSavedPagesID = 
getAppInstallIDForFeature(PrefKeys.getSavedPagesAppInstallId());
-        Log.d("Wikipedia", "Saved Pages ID is" + appInstallSavedPagesID);
-        return appInstallSavedPagesID;
-    }
-
-    private String appInstallSessionsID;
-    public String getAppInstallSessionsID() {
-        appInstallSessionsID = 
getAppInstallIDForFeature(PrefKeys.getSessionsAppInstallId());
-        Log.d("Wikipedia", "Sessions ID is" + appInstallSessionsID);
-        return appInstallSessionsID;
+    private String appInstallID;
+    public String getAppInstallID() {
+        appInstallID = getAppInstallIDForFeature(PrefKeys.getAppInstallId());
+        Log.d("Wikipedia", "appInstallID is" + appInstallID);
+        return appInstallID;
     }
 
     /**
diff --git 
a/wikipedia/src/main/java/org/wikipedia/analytics/AppearanceChangeFunnel.java 
b/wikipedia/src/main/java/org/wikipedia/analytics/AppearanceChangeFunnel.java
index f708a3b..ffbeaf9 100644
--- 
a/wikipedia/src/main/java/org/wikipedia/analytics/AppearanceChangeFunnel.java
+++ 
b/wikipedia/src/main/java/org/wikipedia/analytics/AppearanceChangeFunnel.java
@@ -7,16 +7,16 @@
 
 public class AppearanceChangeFunnel extends Funnel {
     private static final String SCHEMA_NAME = 
"MobileWikiAppAppearanceSettings";
-    private static final int REV_ID = 9378399;
+    private static final int REV_ID = 10375462;
 
-    private final String appInstallToCInteractionID;
+    private final String appInstallID;
     private final Site site;
 
     public AppearanceChangeFunnel(WikipediaApp app, Site site) {
         super(app, SCHEMA_NAME, REV_ID);
 
-        //Retrieve this app installation's unique ID, used to record unique 
users of this feature
-        appInstallToCInteractionID = app.getAppInstallToCInteractionID();
+        //Retrieve this app installation's unique ID, used to record unique 
users of features
+        appInstallID = app.getAppInstallID();
 
         this.site = site;
     }
@@ -24,7 +24,7 @@
     @Override
     protected JSONObject preprocessData(JSONObject eventData) {
         try {
-            eventData.put("appearanceAppInstallID", 
appInstallToCInteractionID);
+            eventData.put("appInstallID", appInstallID);
         } catch (JSONException e) {
             throw new RuntimeException(e);
         }
diff --git 
a/wikipedia/src/main/java/org/wikipedia/analytics/SavedPagesFunnel.java 
b/wikipedia/src/main/java/org/wikipedia/analytics/SavedPagesFunnel.java
index 3deb43b..df54b0a 100644
--- a/wikipedia/src/main/java/org/wikipedia/analytics/SavedPagesFunnel.java
+++ b/wikipedia/src/main/java/org/wikipedia/analytics/SavedPagesFunnel.java
@@ -7,16 +7,16 @@
 
 public class SavedPagesFunnel extends Funnel {
     private static final String SCHEMA_NAME = "MobileWikiAppSavedPages";
-    private static final int REV_ID = 8909354;
+    private static final int REV_ID = 10375480;
 
-    private final String appInstallSavedPagesID;
+    private final String appInstallID;
     private final Site site;
 
     public SavedPagesFunnel(WikipediaApp app, Site site) {
         super(app, SCHEMA_NAME, REV_ID);
 
-        //Retrieve this app installation's unique ID, used to record unique 
users of this feature
-        appInstallSavedPagesID = app.getAppInstallSavedPagesID();
+        //Retrieve this app installation's unique ID, used to record unique 
users of features
+        appInstallID = app.getAppInstallID();
 
         this.site = site;
     }
@@ -24,7 +24,7 @@
     @Override
     protected JSONObject preprocessData(JSONObject eventData) {
         try {
-            eventData.put("savedPagesAppInstallToken", appInstallSavedPagesID);
+            eventData.put("appInstallID", appInstallID);
         } catch (JSONException e) {
             throw new RuntimeException(e);
         }
diff --git a/wikipedia/src/main/java/org/wikipedia/analytics/SessionFunnel.java 
b/wikipedia/src/main/java/org/wikipedia/analytics/SessionFunnel.java
index 1412380..8b93e46 100644
--- a/wikipedia/src/main/java/org/wikipedia/analytics/SessionFunnel.java
+++ b/wikipedia/src/main/java/org/wikipedia/analytics/SessionFunnel.java
@@ -11,7 +11,7 @@
 
 public class SessionFunnel extends Funnel {
     private static final String SCHEMA_NAME = "MobileWikiAppSessions";
-    private static final int REVISION = 9742902;
+    private static final int REVISION = 10375481;
     private WikipediaApp app;
 
     /**
@@ -30,7 +30,7 @@
     private static final String SESSION_PAGES_SAVED_PREF_NAME = 
"SESSION_PAGES_SAVED_PREF";
     private static final String SESSION_PAGES_BACK_PREF_NAME = 
"SESSION_PAGES_BACK_PREF";
 
-    private final String appInstallSessionsID;
+    private final String appInstallID;
     private Date lastEventTime;
     private int pagesFromSearch;
     private int pagesFromRandom;
@@ -57,8 +57,8 @@
         pagesFromSaved = prefs.getInt(SESSION_PAGES_SAVED_PREF_NAME, 0);
         pagesFromBack = prefs.getInt(SESSION_PAGES_BACK_PREF_NAME, 0);
 
-        //Retrieve this app installation's unique ID, used to record unique 
users of this feature
-        appInstallSessionsID = app.getAppInstallSessionsID();
+        //Retrieve this app installation's unique ID, used to record unique 
users of features
+        appInstallID = app.getAppInstallID();
 
         touchSession();
     }
@@ -91,7 +91,7 @@
             //if the result is 0, then we're one of the Chosen.
             final int uuidSubstrLen = 4;
             final int hexBase = 16;
-            boolean chosen = 
Integer.parseInt(appInstallSessionsID.substring(appInstallSessionsID.length() - 
uuidSubstrLen), hexBase) % sampleRate == 0;
+            boolean chosen = 
Integer.parseInt(appInstallID.substring(appInstallID.length() - uuidSubstrLen), 
hexBase) % sampleRate == 0;
 
             if (chosen) {
                 super.log(getApp().getPrimarySite(), params);
@@ -102,7 +102,7 @@
     @Override
     protected JSONObject preprocessData(JSONObject eventData) {
         try {
-            eventData.put("appInstallID", appInstallSessionsID);
+            eventData.put("appInstallID", appInstallID);
         } catch (JSONException e) {
             // This isn't happening
             throw new RuntimeException(e);
diff --git 
a/wikipedia/src/main/java/org/wikipedia/analytics/ToCInteractionFunnel.java 
b/wikipedia/src/main/java/org/wikipedia/analytics/ToCInteractionFunnel.java
index ddabbe2..8d0bdf0 100644
--- a/wikipedia/src/main/java/org/wikipedia/analytics/ToCInteractionFunnel.java
+++ b/wikipedia/src/main/java/org/wikipedia/analytics/ToCInteractionFunnel.java
@@ -7,16 +7,16 @@
 
 public class ToCInteractionFunnel extends Funnel {
     private static final String SCHEMA_NAME = "MobileWikiAppToCInteraction";
-    private static final int REV_ID = 8461467;
+    private static final int REV_ID = 10375484;
 
-    private final String appInstallToCInteractionID;
+    private final String appInstallID;
     private final Site site;
 
     public ToCInteractionFunnel(WikipediaApp app, Site site) {
         super(app, SCHEMA_NAME, REV_ID);
 
-        //Retrieve this app installation's unique ID, used to record unique 
users of this feature
-        appInstallToCInteractionID = app.getAppInstallToCInteractionID();
+        //Retrieve this app installation's unique ID, used to record unique 
users of features
+        appInstallID = app.getAppInstallID();
 
         this.site = site;
     }
@@ -24,7 +24,7 @@
     @Override
     protected JSONObject preprocessData(JSONObject eventData) {
         try {
-            eventData.put("tocInteractionToken", appInstallToCInteractionID);
+            eventData.put("appInstallID", appInstallID);
         } catch (JSONException e) {
             throw new RuntimeException(e);
         }
diff --git 
a/wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java 
b/wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java
index ad9f2b8..7e7d98c 100644
--- a/wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java
+++ b/wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java
@@ -650,7 +650,7 @@
         public RequestBuilder buildRequest(Api api) {
             RequestBuilder builder =  super.buildRequest(api);
             builder.param("prop", builder.getParams().get("prop") + "|" + 
Page.API_REQUEST_PROPS);
-            builder.param("appInstallID", app.getAppInstallReadActionID());
+            builder.param("appInstallID", app.getAppInstallID());
             return builder;
         }
 
diff --git 
a/wikipedia/src/main/java/org/wikipedia/savedpages/RefreshSavedPageTask.java 
b/wikipedia/src/main/java/org/wikipedia/savedpages/RefreshSavedPageTask.java
index 8d86d38..bfd0e56 100644
--- a/wikipedia/src/main/java/org/wikipedia/savedpages/RefreshSavedPageTask.java
+++ b/wikipedia/src/main/java/org/wikipedia/savedpages/RefreshSavedPageTask.java
@@ -34,7 +34,7 @@
     public RequestBuilder buildRequest(Api api) {
         RequestBuilder builder =  super.buildRequest(api);
         builder.param("prop", builder.getParams().get("prop") + "|" + 
Page.API_REQUEST_PROPS);
-        builder.param("appInstallID", app.getAppInstallReadActionID());
+        builder.param("appInstallID", app.getAppInstallID());
         return builder;
     }
 
diff --git a/wikipedia/src/main/java/org/wikipedia/settings/PrefKeys.java 
b/wikipedia/src/main/java/org/wikipedia/settings/PrefKeys.java
index 5ebf70c..a425477 100644
--- a/wikipedia/src/main/java/org/wikipedia/settings/PrefKeys.java
+++ b/wikipedia/src/main/java/org/wikipedia/settings/PrefKeys.java
@@ -14,10 +14,7 @@
     private static String PREFERENCE_REMOTE_CONFIG;
     private static String PREFERENCE_EVENTLOGGING_ENABLED;
     private static String PREFERENCE_STYLES_LAST_UPDATED;
-    private static String PREFERENCE_READING_APP_INSTALL_ID;
-    private static String PREFERENCE_TOC_APP_INSTALL_ID;
-    private static String PREFERENCE_SAVED_PAGES_APP_INSTALL_ID;
-    private static String PREFERENCE_SESSIONS_APP_INSTALL_ID;
+    private static String PREFERENCE_APP_INSTALL_ID;
     private static String PREFERENCE_ONBOARD;
     private static String PREFERENCE_TEXT_SIZE_MULTIPLIER;
     private static String PREFERENCE_COLOR_THEME;
@@ -37,20 +34,14 @@
         PREFERENCE_REMOTE_CONFIG = 
resources.getString(R.string.preference_key_remote_config);
         PREFERENCE_EVENTLOGGING_ENABLED = 
resources.getString(R.string.preference_key_eventlogging_opt_in);
         PREFERENCE_STYLES_LAST_UPDATED = 
resources.getString(R.string.preference_key_styles_last_updated);
-        PREFERENCE_READING_APP_INSTALL_ID = 
resources.getString(R.string.preference_reading_app_install_id);
+        // The app install ID uses readingAppInstallID for backwards 
compatibility with analytics
+        PREFERENCE_APP_INSTALL_ID = 
resources.getString(R.string.preference_reading_app_install_id);
         PREFERENCE_ONBOARD = resources.getString(R.string.preference_onboard);
         PREFERENCE_TEXT_SIZE_MULTIPLIER = 
resources.getString(R.string.preference_text_size_multiplier);
         PREFERENCE_COLOR_THEME = 
resources.getString(R.string.preference_color_theme);
         PREFERENCE_CHANNEL = resources.getString(R.string.preference_channel);
         PREFERENCE_LANGUAGE_MRU = 
resources.getString(R.string.preference_language_mru);
         PREFERENCE_KNOW_TOC_DRAWER = 
resources.getString(R.string.preference_know_toc_drawer);
-
-        // These pref keys were originally stored in different classes from 
the above ones, and as a
-        // result the strings assigned to them do not follow the same pattern 
as the rest.
-        // FIXME: Next time we invalidate these schemas, change strings below 
to follow the pattern
-        PREFERENCE_TOC_APP_INSTALL_ID = 
resources.getString(R.string.preference_toc_app_install_id);
-        PREFERENCE_SAVED_PAGES_APP_INSTALL_ID = 
resources.getString(R.string.preference_saved_pages_app_install_id);
-        PREFERENCE_SESSIONS_APP_INSTALL_ID = 
resources.getString(R.string.preference_sessions_app_install_id);
     }
 
     public static String getContentLanguageKey() {
@@ -89,20 +80,8 @@
         return PREFERENCE_STYLES_LAST_UPDATED;
     }
 
-    public static String getReadingAppInstallId() {
-        return PREFERENCE_READING_APP_INSTALL_ID;
-    }
-
-    public static String getToCAppInstallId() {
-        return PREFERENCE_TOC_APP_INSTALL_ID;
-    }
-
-    public static String getSavedPagesAppInstallId() {
-        return PREFERENCE_SAVED_PAGES_APP_INSTALL_ID;
-    }
-
-    public static String getSessionsAppInstallId() {
-        return PREFERENCE_SESSIONS_APP_INSTALL_ID;
+    public static String getAppInstallId() {
+        return PREFERENCE_APP_INSTALL_ID;
     }
 
     public static String getOnboard() {

-- 
To view, visit https://gerrit.wikimedia.org/r/170285
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I747cc77afa63442c98f55ea2851dbd89940a2407
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Deskana <dga...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to