Skip to content

Commit c14382f

Browse files
Update identity.md
1 parent 489d5b3 commit c14382f

File tree

1 file changed

+1
-1
lines changed
  • src/connections/sources/catalog/libraries/website/javascript

1 file changed

+1
-1
lines changed

src/connections/sources/catalog/libraries/website/javascript/identity.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ analytics.track('Clicked Email', {
168168
169169
This appends the `plan_id` trait to this Track event. This does _not_ add the name or email, since those traits were not added to the `context` object. You must do this for every following event you want these traits to appear on, as the `traits` object does not persist between calls.
170170
171-
Since all non-Identify events do not automatically collect the client's available user `traits`, see [this table](https://segment.com/docs/connections/spec/common/#:~:text=%E2%9C%85-,traits,%E2%9C%85,-userAgent), you'd need to dynamically add that data into the event method in order to include the traits within the event's `context.traits` object. For example, this method uses the Analytics traits method to dynamically add the `traits` cookie into the `Button Clicked` Track event : `analytics.track("Button Clicked", {button:"submit"}, {traits:analytics.user().traits()})`.
171+
Depending on your use case, this step is optional. Since all non-Identify events do not automatically collect the client's available user traits, see [this table](https://segment.com/docs/connections/spec/common/#:~:text=%E2%9C%85-,traits,%E2%9C%85,-userAgent), if you would like to have traits sent to identify() events appended to subsequent calls (e.g., page, track), you'd need to dynamically add that data into the event method in order to include the traits within the event's context.traits object.
172172
173173
You can technically pass the client's available traits within any of Segment events' `context` object. When doing so, please make sure to reference each event method's Spec documentation, listed below, as well as the method's format. As stated above, each Segment event method has an `options` parameter, which is where you can add the `traits` data. Here's the associated documentation to reference for those events and their formats.
174174
- [**Spec Identify**](https://segment.com/docs/connections/spec/identify/) - The [Analytics.js Identify](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#identify) method follows this format : analytics.identify([userId], [traits], [options], [callback]);

0 commit comments

Comments
 (0)