This document describes a legacy version of the Android SDK. If your new to Analyitcs, use the latest SDK. Learn more

Social Interactions - Android SDK

Stay organized with collections Save and categorize content based on your preferences.

This developer guide describes how to measure social interactions using the Google Analytics SDK for Android v3.

Overview

Social interaction measurement allows you to measure a user's interactions with various social network sharing and recommendation widgets embedded in your content.

Social interactions have the following fields:

Field Name Tracker Field Type Required Description
Social Network Fields.SOCIAL_NETWORK String Yes The social network with which the user is interacting (e.g. Facebook, Google+, Twitter, etc.).
Social Action Fields.SOCIAL_ACTION String Yes The social action taken (e.g. Like, Share, +1, etc.).
Social Target Fields.SOCIAL_TARGET String No The content on which the social action is being taken (i.e. a specific article or video).

Social interaction data collected by the Google Analytics SDK for Android v3.x is currently available via custom reports and the Core Reporting API.

Implementation

To send a social interaction to Google Analytics, use MapBuilder.createSocial() as in the following example:

// May return null if EasyTracker has not already been initialized with a
// property ID.
Tracker easyTracker = EasyTracker.getInstance(this);

easyTracker.send(MapBuilder
    .createSocial("Twitter",                                   // Social network (required)
                  "Tweet",                                     // Social action (required)
                  "https://developers.google.com/analytics")   // Social target
    .build()
);