You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/connections/spec/identify.md
+14-9Lines changed: 14 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Segment recommends that you make an Identify call:
12
12
- After a user logs in
13
13
- When a user updates their info (for example, they change or add a new address)
14
14
15
-
The first three examples are pretty self-explanatory, but many might ask: why you would call identify on every page load if you're storing the `userId` in the cookie/local storage?
15
+
The first three examples are pretty self-explanatory, but many might ask: why you would call Identify on every page load if you're storing the `userId` in the cookie/local storage?
16
16
17
17
Calling Identify in one of Segment's [libraries](/docs/connections/sources/) is one of the first steps to getting started with Segment. Refer to library-specific documentation for more details.
18
18
@@ -51,6 +51,8 @@ Beyond the common fields, an Identify call has the following fields:
51
51
{% include content/spec-field-user-id.md %}
52
52
</table>
53
53
54
+
> info ""
55
+
> Note that these traits coming in from your source events are called [custom traits](/docs/unify/traits/custom-traits/).
54
56
55
57
## Example
56
58
@@ -109,7 +111,8 @@ In these cases, you should use an Anonymous ID.
109
111
110
112
The Anonymous ID can be any pseudo-unique identifier. For example, on your servers you can use a session id. If you don't have any readily available identifier, you can always generate a new random one—Segment recommends [UUIDs](http://en.wikipedia.org/wiki/Universally_unique_identifier){:target="_blank"}.
111
113
112
-
**Note:** Segment's [browser and mobile libraries](/docs/connections/sources/)**automatically** use Anonymous IDs to keep track of users as they navigate around your website or app, so you don't need to worry about them when using those libraries.
114
+
> info ""
115
+
> Segment's [browser and mobile libraries](/docs/connections/sources/) automatically use Anonymous IDs to keep track of users as they navigate around your website or app, so you don't need to worry about them when using those libraries.
113
116
114
117
Here's an example of a JavaScript event for an anonymous user:
115
118
@@ -127,17 +130,18 @@ A User ID is usually the unique identifier that you recognize a user by in your
127
130
128
131
Segment recommends using database IDs instead of simple email addresses or usernames, because database IDs _never_ change. That guarantees that even if the user changes their email address, you can still recognize them as the same person in all of your analytics tools. And even better, you'll be able to correlate analytics data with your own internal database.
129
132
130
-
**Instead of using an email address or a username as a User ID, send them along as [traits](/docs/connections/spec/identify#traits).**
133
+
> success ""
134
+
> Instead of using an email address or a username as a User ID, send them along as [custom traits](/docs/unify/traits/custom-traits/).
131
135
132
-
## Traits
136
+
## Custom traits
133
137
134
-
Traits are pieces of information you know about a user that are included in an Identify call. These could be demographics like `age` or `gender`, account-specific like `plan`, or even things like whether a user has seen a particular A/B test variation.
138
+
[Custom traits](/docs/unify/traits/custom-traits/) are pieces of information you know about a user that are included in an Identify call. These could be demographics like `age` or `gender`, account-specific like `plan`, or even things like whether a user has seen a particular A/B test variation.
135
139
136
-
Segment has reserved some traits that have semantic meanings for users, and will handle them in special ways. For example, Segment always expects `email` to be a string of the user's email address. Segment sends this on to destinations like _Mailchimp_ that require an email address for their tracking.
140
+
Segment has reserved some custom traits that have semantic meanings for users, and will handle them in special ways. For example, Segment always expects `email` to be a string of the user's email address. Segment sends this on to destinations like _Mailchimp_ that require an email address for their tracking.
137
141
138
142
You should **only use reserved traits for their intended meaning**.
@@ -146,7 +150,7 @@ Reserved traits Segment has standardized:
146
150
|`avatar`| String | URL to an avatar image for the user |
147
151
|`birthday`| Date | User's birthday |
148
152
|`company`| Object | Company the user represents, optionally containing: `name` (String), `id` (String or Number), `industry` (String), `employee_count` (Number) or `plan` (String) |
149
-
|`createdAt`| Date | Date the user's account was first created. Segment recommends using [ISO-8601](http://en.wikipedia.org/wiki/ISO_8601) date strings. |
153
+
|`createdAt`| Date | Date the user's account was first created. Segment recommends using [ISO-8601](http://en.wikipedia.org/wiki/ISO_8601){:target="_blank"} date strings. |
150
154
|`description`| String | Description of the user |
151
155
|`email`| String | Email address of a user |
152
156
|`firstName`| String | First name of a user |
@@ -159,6 +163,7 @@ Reserved traits Segment has standardized:
159
163
|`username`| String | User's username. This should be unique to each user, like the usernames of Twitter or GitHub. |
160
164
|`website`| String | Website of a user |
161
165
162
-
**Note:** You might be used to some destinations recognizing special traits by slightly different names. For example, Mixpanel recognizes a `$created` trait when the user's account was first created, while Intercom recognizes the same trait as `created_at` instead. Segment attempts to handle all the destination-specific conversions for you automatically. If you need help understanding if a specific field will be converted to a destination, take a look at Segment's [open source integration code](https://github.com/segment-integrations?q=&type=all&language=&sort=){:target="_blank"}, view the destination's documentation, or [contact Segment support](https://app.segment.com/workspaces?contact=1).
166
+
> info ""
167
+
> You might be used to some destinations recognizing special traits by slightly different names. For example, Mixpanel recognizes a `$created` trait when the user's account was first created, while Intercom recognizes the same trait as `created_at` instead. Segment attempts to handle all the destination-specific conversions for you automatically. If you need help understanding if a specific field will be converted to a destination, take a look at Segment's [open source integration code](https://github.com/segment-integrations?q=&type=all&language=&sort=){:target="_blank"}, view the destination's documentation, or [contact Segment support](https://app.segment.com/workspaces?contact=1){:target="_blank"}.
163
168
164
169
**You can pass these reserved traits using camelCase or snake_case**, so in JavaScript you can match the rest of your camel-case code by sending `firstName`, while in Ruby you can match your snake-case code by sending `first_name`. That way the API never seems alien to your code base. Keep in mind that not all destinations support these reserved traits, so sending these traits in camelCase and snake_case can result in two sets of traits in other destinations.
0 commit comments