Close

Introduction

Amplitude

Provides access to https://amplitude.com/ mobile analytics. Wraps Amplitude’s iOS and Android SDKs.

Note: Session tracking may not work correctly when running Experiences in the main Expo app. It will work correctly if you create a standalone app.

Expo.Amplitude.initialize(apiKey)

Initializes Amplitude with your Amplitude API key. Find your API key using these instructions.

Arguments

  • apiKey (string) — Your Amplitude application’s API key.

Expo.Amplitude.setUserId(userId)

Assign a user ID to the current user. If you don’t have a system for user IDs you don’t need to call this. See https://amplitude.zendesk.com/hc/en-us/articles/206404628-Step-2-Assign-User-IDs-and-Identify-your-Users.

Arguments

  • userId (string) — User ID for the current user.

Expo.Amplitude.setUserProperties(userProperties)

Set properties for the current user. See https://amplitude.zendesk.com/hc/en-us/articles/207108327-Step-4-Set-User-Properties-and-Event-Properties.

Arguments

  • userProperties (object) — A map of custom properties.

Expo.Amplitude.clearUserProperties()

Clear properties set by Expo.Amplitude.setUserProperties().

Expo.Amplitude.logEvent(eventName)

Log an event to Amplitude. https://amplitude.zendesk.com/hc/en-us/articles/206404698-Step-3-Track-Events-and-Understand-the-Actions-Users-Take has information about what kind of events to track.

Arguments

  • eventName (string) — The event name.

Expo.Amplitude.logEventWithProperties(eventName, properties)

Log an event to Amplitude with custom properties. https://amplitude.zendesk.com/hc/en-us/articles/206404698-Step-3-Track-Events-and-Understand-the-Actions-Users-Take has information about what kind of events to track.

Arguments

  • eventName (string) — The event name.

  • properties (object) — A map of custom properties.

Expo.Amplitude.setGroup(groupType, groupNames)

Add the current user to a group. See https://github.com/amplitude/Amplitude-iOS#setting-groups and https://github.com/amplitude/Amplitude-Android#setting-groups.

Arguments

  • groupType (string) — The group name, e.g. “sports”.

  • groupNames (object) — An array of group names, e.g. [“tennis”, “soccer”]. Note: the iOS and Android Amplitude SDKs allow you to use a string or an array of strings. We only support an array of strings. Just use an array with one element if you only want one group name.


Still have questions? Ask on our forums!