Many social networks provide embeddable buttons and widgets that allow users to easily share content from the web or from an app (e.g., the Twitter share button). User interactions with these embedded social buttons represent social interactions with your content. These social interactions are valuable signals of user engagement and can be measured using Analytics.
In this article:Data collection
A social interaction, like a pageview, screen view, or an event, is a unique hit type that includes a set of unique values to describe the social interaction.
The Data Model
A social interaction in Analytics is represented by the following fields:
Field | Type | Required | Description |
---|---|---|---|
socialNetwork | string |
Required | The social network being measured (e.g., Facebook, Twitter). |
socialAction | string |
Required | The social action the user is taking, e.g., “Like”, “Share”. |
socialTarget | string |
Optional | The content on which the social action was taken, e.g., the path of an article or video. |
Measurement
A social interaction should be measured when a user completes an interaction with an embedded social button or widget.
For example, a developer could measure the interaction of a user with the Twitter button on a web page using the following values:
Each button or widget may have its own API with which developers need to integrate with to measure social interactions. Developers should refer to the API documentation provided by each social network for more information on how best to integration.
Collecting Social Interactions
Developers can collect social interaction data using the following client libraries or protocols:
Web: analytics.js
Android SDK
iOS SDK
Measurement Protocol
Reporting
After processing, social interaction data can be accessed via the Social Plugin report or custom reports in the web interface, or via the Core Reporting API.
The following are the social interaction dimensions and metrics available in Analytics:
Social Interaction Dimensions
Web Interface | Core Reporting API | Description |
---|---|---|
Social Source | ga:socialInteractionNetwork | a value representing the social network being tracked (e.g., Google, Facebook, Twitter, LinkedIn) |
Social Action | ga:socialInteractionAction | a value representing the social action being tracked (e.g., share, like, bookmark) |
Social Source and Action | ga:socialInteractionNetworkAction | a value representing the concatenation of the social network and action measured (e.g., Google: Share , Facebook: Like |
Social Entity | ga:socialInteractionTarget | a value representing the URL (or resource) which receives the social network action. |
Social Interaction Metrics
Web Interface | Core Reporting API | Description |
---|---|---|
Social Actions | ga:socialInteractions | The total number of social interactions. |
Unique Social Interactions | ga:uniqueSocialInteractions | Number of sessions during which the specified social action(s) occurred at least once. Based on unique combination of network, action, and target. |
Actions per Social Session | ga:socialInteractionsPerSession | The number of social interactions per session. |
For the complete list of social interaction dimensions and metrics available via the Core Reporting API, see the Core Reporting API Social Dimensions and Metrics reference.
Example
The following end-to-end example will show how values are collected, processed, and made available via the various social interaction dimensions and metrics.
Collection
In this example, a single user shares two different articles from a website using an embedded Twitter "share" button. At collection time, the developer sends two social interactions to Analytics, one after each "share" is completed, with the following values:
Reporting
After processing, a custom report that uses social entity as the dimension and each of the social action metrics would look like this:
Social Entity | Social Actions | Unique Social Actions | Actions per Social Session |
---|---|---|---|
/articles/2012/june/article?id=5555 | 1 | 1 | 2 |
/articles/2012/june/article?id=6000 | 1 | 1 | 2 |
On the other hand, a custom report that used Social Action as the dimension with the same social action metrics used above would look like this:
Social Action | Social Actions | Unique Social Actions | Actions per Social Session |
---|---|---|---|
Twitter / Share | 2 | 1 | 2 |
Unique Social Actions
In the example above, note that there is only one unique social action attributed to the network / action combination Twitter / Share
. Even though the user interacted with two separate Twitter share buttons, they both had the network / action combination of Twitter / Share
, which results in a single unique social action in the reports.
Actions per Social Session
Lastly, in the same example above, note that Actions per Social Session is calculated by dividing the total number of Social Actions, in this case, 2, by the number of unique social actions, in this case, 1
.