Menu
Amazon Mobile Analytics
User Guide

Adding Attributes and Metrics

Attributes are data that provides context for the submitted event. For example, a game that submits an event to Mobile Analytics when the player collects a power-up bonus might include an attribute named for the type of bonus collected. You add attributes to an event as a collection of key-value pairs.

Metrics are data that gives measurable context to the event. For example, a photo-sharing app that submits an event when selected photos are uploaded might include a metric for the total amount of data being uploaded, in megabytes. You add metrics to an event as a collection of key-value pairs.

Reporting Detailed Data Points

Individual data values sent to Mobile Analytics are specified by adding one or more attributes or metrics to an event before you submit it. An event can include any combination of up to 40 total attributes and metrics. As a best practice, we recommend you give a general name to a custom event and specific names to attributes or metrics. For example, using "Item Bought" instead of "Item XYZ" as a custom event name helps keep the report from having too many distinct event names that are hard to read and aggregate. This example demonstrates how to define a custom event.

Adding Attributes and Metrics in iOS or Android Apps

Attributes and metrics are added to events in iOS and Android apps by creating a custom event object and then adding the required key-value pairs using the addAttribute or addMetrics methods.

For information about adding attributes and metrics to events in iOS or Android apps, see:

Adding Attributes and Metrics in JavaScript Apps

Attributes and metrics are added to custom events in JavaScript apps as parameter values.

For more information, see Mobile Analytics SDK for JavaScript.

Adding Attributes and Metrics in Unity or Xamarin Apps

Attributes and metrics are added to events in Unity or Xamarin apps by creating a custom event object and then adding the required key-value pairs using the addAttribute or addMetrics methods.

For information about adding attributes and metrics to events in Unity or Xamarin apps, see: