SegmentIO

class segmentio.SegmentIO(api_secret)

Create a SegmentIO service

Variables:api_secret (str) – Your project’s API secret.

User

SegmentIO.user(user_id)

Return the resource corresponding to a single user

User.identify(traits=None, context=None, timestamp=None)

Identify an user.

Variables:
  • traits (dict) – A dictionary of traits you know about the user.
  • context (dict) – A dictionary of provider specific options.
  • timestamp – An ISO 8601 date string representing

when the identify took place. :vartype timestamp: str

User.track(event, properties=None, context=None, timestamp=None)

Track an event.

Variables:
  • event (str) – The name of the event you’re tracking.
  • properties (dict) – A dictionary of properties for the event.
  • context (dict) – A dictionary of provider specific options.
  • timestamp – An ISO 8601 date string representing

when the event took place. :vartype timestamp: str

Service methods

SegmentIO.alias(from_user_id, to_user_id, context=None, timestamp=None)

Identify an user.

Variables:
  • from_user_id (str) – The anonymous user’s id before they are logged in.
  • to_user_id (str) – The identified user’s id after they’re logged in.
  • context (dict) – A dictionary of provider specific options.
  • timestamp – An ISO 8601 date string representing

when the identify took place. :vartype timestamp: str

SegmentIO.batch_import(batch, context=None)

The import method lets you send a series of identify, group, track, page and screen requests in a single batch

Variables:
  • batch (dict) – List of actions.
  • context (dict) – A dictionary of provider specific options.