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 Exponent app. It will work correctly if you create a standalone app.

Exponent.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.

Exponent.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.

Exponent.Segment.identify(userId)

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

Arguments

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

Exponent.Segment.identifyWithTraits(userId, traits)

Associates the current user with a user ID and some metadata. Call this after calling Exponent.Segment.initializeIOS() and Exponent.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.

Exponent.Segment.track(event)

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

Arguments

  • event (string) — The event name.

Exponent.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.

Exponent.Segment.flush()

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


© Copyright 2025, Exponent. Created using Gatsby.