Reputation: 3718
I have the following code to track when an app is launched for the first time on a device, however it doesn't match the data I am getting from Google Analytics in the New Users category. Can anyone see anything in the code that could be unreliable? For example, today I see 3 installs from this code, but I have 5 new users who could only download this app from Google Play.
String INSTALL_SOURCE = "Google Play";
TelephonyManager tm;
tm = (TelephonyManager) getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);
String INSTALL_COUNTRY = tm.getSimCountryIso();
prefs = getSharedPreferences("user_stats", MODE_PRIVATE);
boolean firstTime = prefs.getBoolean("isFirstTime", true);
if (firstTime) {
rentracker.trackEvent("Install Source", INSTALL_SOURCE, INSTALL_COUNTRY, 1);
Editor editor = prefs.edit();
editor.putBoolean("isFirstTime", false);
editor.commit();
}
Log.d(TAG, "Is this the first time?: " + firstTime);
String android_id = Secure.getString(this.getContentResolver(),
Secure.ANDROID_ID);
rentracker.trackEvent("App Startup - " + INSTALL_SOURCE, INSTALL_COUNTRY, "ID: " + android_id,1);
Upvotes: 1
Views: 550
Reputation: 1006574
Can anyone see anything in the code that could be unreliable?
As one commenter suggested, just because this code exists does not mean that it actually has run, as the user may not have launched your activity yet. If you think that this code will somehow automatically run without the user's involvement, that is probably not the case on Android 3.1 and higher.
Presumably, rentracker
is supposed to be communicating over the Internet, but not everyone has continuous Internet access. Hence, it may be that your code has run, but your back end has not found out about that yet, because the user was not online at the time.
You are assuming that the Play Store Developer Console reports downloads accurately and in a timely fashion. The Play Store Developer Console has not been the most reliable piece of software in human history, and so it is entirely possible that your comparison data is flawed.
Upvotes: 2