Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Analytics Android SDK V4 confusion

Tags:

I have been using Google Analytics SDK for Android V3 in my apps so far, and it has been working fine (My Apps are supported on Android 3.0 and above). Now the V3 has been deprecated, and the latest one is Google Analytics SDK v4 for Android.

I was able to get it to work by reading the official documentation along with this blog post. But I still have a few questions:

1) What is a Global Tracker and an App Tracker? What is the concept behind it? If I have more than one Android Apps, then whats the difference. Should all my apps have the same Global Tracker? is it 'global' in that sense? I am a little clueless here.
2) The V4 uses Google Play Services V4.3 and above, and does not have a Standalone Library like V3 had. So, is it safe to remove the V3 library jar file and the code? The Google Developers page does say this:

The SDK can be used and will work on devices that do not have Google Play Services. In this case the SDK will will automatically fall back to local dispatching.

Also

In general, devices running Android 2.3 (Gingerbread) or later and have the Google Play Store app installed receive updates within a few days. This allows you to use the newest APIs in Google Play services and reach most of the devices in the Android ecosystem (devices older than Android 2.3 or devices without the Google Play Store app are not supported).

So with V4, will my app tracking still work on all the devices which may not have the Google Play Services V4.3 or above? If not, then will the app crash on account of not finding a particular class needed by the analytics code? Or, Is it safe to assume that all devices with Android 2.3+ will be compatible with Analytics V4?

Note: The Google Play Services documentation page does show how to check if Google Play Services are available. But I don't want to prompt the user unnecessarily as the analytics does not affect the functionality of my app. Also, I can put a check, but I don't want to miss on any analytics information.

like image 388
rgamber Avatar asked May 27 '14 20:05

rgamber


2 Answers

1) What is a Global Tracker and an App Tracker? What is the concept behind it? If I have more than one Android Apps, then whats the difference. Should all my apps have the same Global Tracker? is it 'global' in that sense? I am a little clueless here.

They are pretty much the same thing. Just configured in different ways to serve as example. You might want to use both if you have several apps, so that you have each app tracked to it's own Google Analytics Property and also to a global property that rolls up all data. But the tracker objects are exactly the same. Most of the time you just use one or the other. So ignore that part from the docs, and read them as examples only on how to setup trackers. Choose one and stick to it. I would recommend the xml configuration method, which is cleaner.

2) The V4 uses Google Play Services V4.3 and above, and does not have a Standalone Library like V3 had. So, is it safe to remove the V3 library jar file and the code? The Google Developers page does say this

Yes. Safe to remove. Any Android device above 2.2 will have Play Services installed. You might want to check if it's not available to just skip tracking altogether in your app.

like image 53
Eduardo Avatar answered Sep 22 '22 13:09

Eduardo


1) What is a Global Tracker and an App Tracker? What is the concept behind it? If I have more than one Android Apps, then whats the difference. Should all my apps have the same Global Tracker? is it 'global' in that sense? I am a little clueless here.

Global tracker is meant to track things that you'd like to track across different apps of yours whether they're different apps altogether or same app for different platforms. You could just keep an app tracker and not use any global tracker if you don't need it.

2) The V4 uses Google Play Services V4.3 and above, and does not have a Standalone Library like V3 had. So, is it safe to remove the V3 library jar file and the code?

Yes, V3 library jar is not needed anymore. Instead of using the Analytics V3 library you're using the Play Services library now. The main difference is that instead of your app dispatching the data (via the Analytics V3 library), the dispatch will happen via Play Services APK to which the Play services library present in your app will pass the data. In case, the required Play Services APK is not available on the device, the Play services library will fall back to local dispatching meaning instead of Play Services APK dispatching the data your app will directly dispatch the data like it used to do in V3 and before.

What Analytics becoming part of Play services 4.3 means to me is:

  1. Google Analytics becomes first class citizen on Android. Play services is more popular than the standalone Analytics library and I expect more people start using GA with this change.
  2. Dispatching becoming a part of Play Services APK will be able to get faster improvements because of automatic updating of the APK.

There are other enhancements in the API itself (Global tracker, etc.) but they don't have anything to do with Analytics becoming part of the Play services.

like image 22
Atul Goyal Avatar answered Sep 22 '22 13:09

Atul Goyal