segmentio / segmentio/analytics.js-integrations

Feature request: Support for passing traits to analytics.track()

Open
#505 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
125
Forks
136
Avg merge
2h 45m
Merged PRs (30d)
1

Description

My current understanding of Segment's API:

  1. analytics.track() supports passing properties associated with the event.
  2. analytics.identify() supports passing traits that are associated with the user.
  3. #1 and #2 above are two separate API calls and there is no ordering guarantee; that is, they'll won't be delivered to the destination in the same order they were called.

This is a problem because some destinations, such as Amplitude, will associate traits with events under-the-hood. So if the event was sent to the destination, Amplitude, before the traits, the traits won't be associated with that event and thus will be useless.

For this reason, Amplitude supports passing user traits along with API calls to create events here,. This essentially combines analytics.track() and analytics.identify() into a single, atomic API call to:

  1. Create a new event
  2. Associate properties with that event
  3. Update traits on the user that are queryable in Amplitude at the time of that event

Would it be possible to add the ability to pass traits to analytics.track() that will be forwarded to destinations that support it?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the analytics.track() entry point and review how integrations receive event properties and identify traits. Check the linked Amplitude API documentation and determine which destinations can accept traits with events; done means supported destinations forward them atomically without changing existing track behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.