Android: Google Analytics availability in Google Play Services?

Google Analytics has been announced to become part of the rolling out Google Play Services 4.3, however it is not yet included in the Google Play Services packages list:

http://developer.android.com/reference/gms-packages.html

Any idea when it will become available, and will it be safe to be used straight away, or will it be better to wait for some time to make sure every user has Google Play Services 4.3 already installed?

Google Play Services availability and Google Play

We developed an application that uses the Google Play Services extension. I assume that people without Google Play Services installed on their device side will not be able to use these services. Howev

`NoSuchMethodError` trying to use certain Google Analytics methods in Google Play Services Xamarin Component

After finally upgrading from an old beta Android Google Analytics C# binding in favor of the Google Analytics integration with Google Play Services, I’m hitting a snag with Java.Lang.NoSuchMethodError

Android: Google Analytics as part of Google Play Service

Now that Google Analytics will become part of the Google Play Services 4.3, which changes do we need to expect? do we still need to include the GoogleAnalytics jar into the Android project? what about

How can I dispatch Google Analytics beacon via Google Tag Manager SDK v4 with Google Play Services?

I’m trying to implement Google Tag Manager and Google Analytics Android SDK v4 with Google Play Services. I made my sample source based on this developer guide. It seems that my sample source doesn’t

Include Android Google Play Services failed?

I’m trying to include Google Play Services in my project to use Google Maps Android API v2, based on steps provided by Google in this link Google Play Service Setup But unfortunately, the include pro

Android Google Play Services Without Play Store

I’m considering making a custom Android tablet running a 99.99% AOSP ROM. My life would be much easier if Google Play Services was available to me while writing apps for it, but I can’t find any offic

update google play services – Android

I added Google+ Sign in to my app using GoogleApiClientbut when I try to Sign In, the app ask to update my Google Play Services on my phone even though is already updated .. I also tried to impl

Android google play services SDK

Am having a strange problem , I installed the Google Play Services SDK following the instruction site , but I can’t find the lib folder any ideas what is causing this ?

Android Studio Google Play Services no autocomplete

I use AS 0.4.2 then imported GMS as described in doc: https://developer.android.com/google/play-services/setup.html dependencies { compile ‘com.android.support:support-v4:19.0.0’ compile ‘com.android

Google Play Services with AdMob. Check availability?

I’m in the process of migrating from AdMob SDK to Google Play Services. I’ve done most of the job and things seem to be working fine, but I’m not sure I understand the logic behind some of the interac

Answers

It’s part of the package list now.

I think the basic functionality works something like this…

import com.google.android.gms.analytics.GoogleAnalytics;

@Override
protected void onStart() {
    super.onStart();
    GoogleAnalytics.getInstance(this).reportActivityStart(this);
}

@Override
protected void onStop() {
    super.onStop();
    GoogleAnalytics.getInstance(this).reportActivityStop(this);
}

The documentation for Google Analytics SDK v4 (now part of Google Play Services) has just been published!

https://developers.google.com/analytics/devguides/collection/android/v4/

I’ve noticed some other differences.

Tracker

To get a new Tracker, use the newTracker() method (accepts both a String value and an int value [for XML configuration]):

googleTracker = gaInstance.getTracker(GA_KEY); // OLD
googleTracker = gaInstance.newTracker(GA_KEY); // NEW

EasyTracker

EasyTracker has now disappeared, so we will have to use GoogleAnalytics.getInstance(this).reportActivityStart(this) as reported by Paito.

Setters

The googleTracker.set() method is no longer available. It has been replaced with more specialised methods, for example:

googleTracker.set(Fields.SCREEN_NAME, null); // OLD
googleTracker.setScreenName(null);           // NEW

Event creation

The googleTracker.send() method has also seen some changes.

googleTracker.send(MapBuilder
                .createEvent(category, action, label, value)
                .build()); // OLD
googleTracker.send(new HitBuilders.EventBuilder()
                .setCategory(category)
                .setAction(action)
                .setLabel(label)
                .setValue(value)
                .build()); // NEW

AppView

It now becomes

googleTracker.send(MapBuilder.createAppView().build());       // OLD
googleTracker.send(new HitBuilders.AppViewBuilder().build()); // NEW

AppViewBuilder

AppViewBuilder has now been deprecated, replaced by the new ScreenViewBuilder class. (thanks Hai Phong for the tip!)


For those who are running into (or have already dealt with) the Dalvik’s 64K methods limit, there are now 3K methods that you will be able to get rid of in your application, thanks to this integration.

As per conversation in order to use Easytracker replacement with

GoogleAnalytics.getInstance(this).reportActivityStart(this);
GoogleAnalytics.getInstance(this).reportActivityStop(this);

You need to add your config to AndroidManifest like

<meta-data android:name="com.google.android.gms.analytics.globalConfigResource" android:resource="@xml/analytics_global_config" />

I’m still having to get instance of Tracker to send Events, may be somebody else would have better luck at replacing

 EasyTracker.getInstance(mContext).send(MapBuilder....)