Close

Introduction

Segment

Provides access to https://segment.com/ mobile analytics. Wraps Segment’s iOS and Android sources.

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.Segment.initializeIOS(writeKey)

Segment requires separate write keys for iOS and Android. Call this with the write key for your iOS source in Segment.

Arguments

  • writeKey (string) — Write key for iOS source.

Expo.Segment.initializeAndroid(writeKey)

Segment requires separate write keys for iOS and Android. Call this with the write key for your Android source in Segment.

Arguments

  • writeKey (string) — Write key for Android source.

Expo.Segment.identify(userId)

Associates the current user with a user ID. Call this after calling Expo.Segment.initializeIOS() and Expo.Segment.initializeAndroid() but before other segment calls. See https://segment.com/docs/spec/identify/.

Arguments

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

Expo.Segment.identifyWithTraits(userId, traits)

Associates the current user with a user ID and some metadata. Call this after calling Expo.Segment.initializeIOS() and Expo.Segment.initializeAndroid() but before other segment calls. See https://segment.com/docs/spec/identify/.

Arguments

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

:param object traits

A map of custom properties.

Expo.Segment.track(event)

Log an event to Segment. See https://segment.com/docs/spec/track/.

Arguments

  • event (string) — The event name.

Expo.Segment.trackWithProperties(event, properties)

Log an event to Segment with custom properties. See https://segment.com/docs/spec/track/.

Arguments

  • event (string) — The event name.

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

Expo.Segment.flush()

Manually flush the event queue. You shouldn’t need to call this in most cases.


Still have questions? Ask on our forums!