I created a pop-up dialog that announces the recent changes to the user after an upgrade. Inside that logic I put a trackEvent call to Google Analytics with a label of the Application Version and a value of 1 so each time that dialog is presented I get a +1 for that label. Here's how:
if (!appPrefs.getAppVer().equals(getAppVerName())) { ... tracker.trackEvent("Upgrade", "Click", getAppVerName(), 1); appPrefs.saveAppVer(getAppVerName()); appPrefs.saveAcceptedUsageAggrement(false); }
getAppVerName() is just a helper method that does the following:
public String getAppVerName() { String text; try { text = getPackageManager().getPackageInfo(getPackageName(), 0).versionName; } catch (NameNotFoundException e) { text = "Version Not Found"; } return text; }
On your application's main activity screen you can also add a trackEvent to help keep track of which versions are being executed like so:
public class MyActivity extends Activity { GoogleAnalyticsTracker tracker; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); tracker = GoogleAnalyticsTracker.getInstance(); tracker.start("UA-12345678-1", this); tracker.trackPageView("/HomeScreen"); tracker.trackEvent("HomeScreen", "Click", getAppVerName(), 1); tracker.dispatch(); setupViews(); } }
Google Analytics will record 2 events for you: one called Upgrade and the other called HomeScreen. Both will have a label of the version making the call and a counter. Also of note; in the recent changes logic I also set the Accepted Usage Agreement to false allowing me to re-display the usage agreement on upgrade.