Google Analytics SDK for Android: Migrating from v1.x to v2.x

This migration guide describes what's new in version 2 of the SDK, and provides developers with tips to migrate from a v1.x implementation. Developers who do not need to migrate from a v1.x implementation can Get Started with Version 2 now.

Introduction

Google Analytics recently released the updated Google Analytics SDK for Android version 2. Version 2 of the SDK contains support for new features and a new reporting interface designed specifically for app developers.

We recommend that all existing Google Analytics developers migrate to version 2 of the Google Analytics SDK for Android to take advantage of the new features and reports.

What's New in Version 2

The Google Analytics SDK for Android version 2 introduces a new reporting experience designed for app developers, powerful new dimensions and metrics, and much more. Here's a look at what developers get with version 2:

More powerful reports for app developers
The standard reports have been redesigned for app developers, adding new reports like Engagement Flow and Google Play Sources to help developers gain new insight into user acqusition and experience. Read our Account Configuration Best Practices to learn more about how best to configure your property for version 2.
New app dimensions and metrics
New app-specific dimensions and metrics have been introduced with version 2 of the SDK, including Screen Name and Screen Views, App Name, App version, and many more.
Measure crashes and exceptions
The Google Analytics SDK for Android introduces exception measurement and the exception hit type. Using exception measurement, you can measure the number and type of crashes and non-fatal exceptions. To learn how to implement exception measurement, see the Exceptions Developer Guide.
Custom dimensions and metrics
Create custom dimensions to segment your data in new ways. Learn more about Custom Dimensions and Metrics.
Measure social interactions
Gain new insight into the value of social in your app by measuring user interactions with embedded social plugins and widgets. Learn more about measuring Social Interactions.

Before you Begin

All developers will want to take these two steps before beginning their migration:

  1. Download the Google Analytics SDK for Android v2
  2. Create an app view (profile) that you'll use to access your new app reports and data.

Once you've completed the above steps, follow the steps below for your migration path.

Migrating from EasyTracker

There are three steps you'll want to take to migrate your app from v1 to v2 of the EasyTracker library:

  1. Update the parameters in your GoogleAnalytics.xml resource file
  2. Update method names
  3. Update your broadcast receiver (Google Play Campaign Tracking)

1. Update Parameters in GoogleAnalytics.xml

When migrating to version 2, update the parameters in your GoogleAnalytics.xml resource file, as some of them have changed since v1.x and new parameters have been added in version 2.

The table below shows the parameters that have been updated in version 2:

v1.x parameter namev2.x parameter name
ga_api_keyga_trackingId
ga_auto_activity_trackingga_autoActivityTracking
ga_dryRundeprecated

To learn more, see the new and updated EasyTracker Parameters.

2. Update Method Names

Although much of the syntax remains the same in version 2 of EasyTracker, there are some notable differences in method names and syntax that will require you to update your implementation:

3. Update Broadcast Receiver (Google Play Campaign Tracking)

Developers who had implemented Google Play Campaign Tracking using v1.x should note that the class path of the receiver has changed. See the Google Play Campaign Tracking Guide for more information.

Migrating from a Custom Implementation

If you were not using the EasyTracker library in v1.x of the Analytics SDK for Android, we recommend you begin using EasyTracker in version 2.

The EasyTracker library is now included with the SDK and is the recommended for all developers. Get started using EasyTracker in the Google Analytics SDK v2.

If you have advanced data collections needs, such as using multiple property IDs in a single implementation, read the Advanced Configuration Guide to learn more about using advanced features of v2.x of the SDK.