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
|[Custom traits](/docs/unify/traits/custom-traits/)| Traits created from source events you pass into Segment. From your sources, send custom traits as pieces of information that you know about a user in an Identify call. |
10
+
|[Computed traits](/docs/unify/traits/computed-traits/)| Traits collected from computations off of event and event property data from your sources. Create user or account-level calculations like `most_viewed_page` or `total_num_orders` for a customer. Learn more by viewing [types of computed traits](/docs/unify/traits/computed-traits/#types-of-computed-traits). |
11
+
|[SQL traits](/docs/unify/traits/sql-traits/)| Traits created by running SQL queries on data in your warehouse. SQL traits are a type of computed trait. SQL traits help you import traits from your data warehouse back into Segment to build audiences or enhance data that you send to other destinations. |
12
+
13
+
<!--
14
+
| [Predictive traits](/docs/unify/traits/predictions/using-predictions/) | Segment creates Predictions as Computed Traits, with scores saved to user profiles as a percentage cohort. | -->
Copy file name to clipboardExpand all lines: src/connections/spec/identify.md
+16-10Lines changed: 16 additions & 10 deletions
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,19 @@ 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
-
You should **only use reserved traits for their intended meaning**.
142
+
> warning ""
143
+
> Only use reserved traits for their intended meaning.
@@ -146,7 +151,7 @@ Reserved traits Segment has standardized:
146
151
|`avatar`| String | URL to an avatar image for the user |
147
152
|`birthday`| Date | User's birthday |
148
153
|`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. |
154
+
|`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
155
|`description`| String | Description of the user |
151
156
|`email`| String | Email address of a user |
152
157
|`firstName`| String | First name of a user |
@@ -159,6 +164,7 @@ Reserved traits Segment has standardized:
159
164
|`username`| String | User's username. This should be unique to each user, like the usernames of Twitter or GitHub. |
160
165
|`website`| String | Website of a user |
161
166
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).
167
+
> info ""
168
+
> 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
169
164
170
**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.
Copy file name to clipboardExpand all lines: src/engage/audiences/index.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -36,9 +36,9 @@ Select `and not who` to indicate users that have not performed an event. For exa
36
36
37
37
You can also specify two different types of time-windows, `within` and `in between`. The `within` property lets you specify an event that occurred in the last `x` number of days, while `in between` lets you specify events that occurred over a rolling time window in the past. A common use case is to look at all customers that were active 30 to 90 days ago, but have not completed an action in the last 30 days.
38
38
39
-
### Custom Traits
39
+
### Custom Traits
40
40
41
-
You can also build Audiences based on custom traits. These traits can be collected from your apps when a user completes a form or signs up using an [Identify](/docs/connections/spec/identify) call. You can view these traits in the Profile explorer, as well. Custom Traits are mutable and update to the latest value seen by the user's Identify events.
41
+
You can also build Audiences based on [custom traits](/docs/unify/traits/custom-traits/). These traits can be collected from your apps when a user completes a form or signs up using an [Identify](/docs/connections/spec/identify) call. You can view these traits in the Profile explorer, as well. Custom Traits are mutable and update to the latest value seen by the user's Identify events.
42
42
43
43
> info ""
44
44
> When an audience that previously generated Identify events is deleted, the data for the audience key is still attached to profiles that entered the audience, and becomes visible in Segment as a custom trait.
Copy file name to clipboardExpand all lines: src/engage/profiles/csv-upload.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -55,7 +55,7 @@ A blank subscription status in the CSV doesn't overwrite current **email** or **
55
55
56
56
Every time you upload a file, you have the option to add a custom trait to user profiles in the CSV. Use custom traits to help you [create audiences](/docs/engage/audiences/#building-an-audience) or send messages to a specific group of users. You can also add an existing custom trait name from your Segment workspace to the list of users in the CSV file.
57
57
58
-
Custom traits display in the Custom Traits tab of a user profile in the Profile explorer.
58
+
[Custom traits](/docs/unify/traits/custom-traits/) display in the Custom Traits tab of a user profile in the Profile explorer.
Copy file name to clipboardExpand all lines: src/unify/Traits/computed-traits.md
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,8 @@ redirect_from:
12
12
13
13
Computed Traits allow you to quickly create user or account-level calculations that Segment keeps up-to-date over time. These can be computations like the `total_num_orders` a customer has completed, the `lifetime_revenue` of a customer, the `most_frequent_user` to determine which user is most active in an account, or the `unique_visitors_count` to assess how many visitors from a single domain. These computations are based on your events and event properties that you are sending through Segment on the [page](/docs/connections/spec/page/) and [track](/docs/connections/spec/track) calls.
14
14
15
+
{% include content/trait-types.md %}
16
+
15
17
## Types of Computed Traits
16
18
17
19
Segment currently supports the following types of computed traits:
Custom traits are user or account traits collected from the Identify calls you send to Segment. For example, 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. From your sources, send custom traits as pieces of information that you know about a user in an Identify call.
7
+
8
+
As opposed to [computed traits](/docs/unify/traits/computed-traits/) which are computed from your source data, or [SQL Traits](/docs/unify/traits/sql-traits/) which are computed from warehouse data, custom traits are created from source events you pass into Segment.
9
+
10
+
{% include content/trait-types.md %}
11
+
12
+
13
+
## Using custom traits
14
+
15
+
Here's the payload of a typical Identify call with custom traits (with most [common fields](/docs/connections/spec/common/) removed):
> Any source event where there's a `traits` object and key value pairs generates custom traits.
43
+
44
+
Custom traits are mutable and update to the latest value seen by the user's Identify events.
45
+
46
+
When an audience that previously generated Identify events is deleted, the data for the audience key is still attached to profiles that entered the audience and becomes visible in Segment as a custom trait.
47
+
48
+
49
+
50
+
## Reserved custom traits
51
+
52
+
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.
53
+
54
+
> warning ""
55
+
> Only use reserved custom traits for their intended meaning.
|`address`| Object | Street address of a user optionally containing: `city`, `country`, `postalCode`, `state`, or `street`|
62
+
|`age`| Number | Age of a user |
63
+
|`avatar`| String | URL to an avatar image for the user |
64
+
|`birthday`| Date | User's birthday |
65
+
|`company`| Object | Company the user represents, optionally containing: `name` (String), `id` (String or Number), `industry` (String), `employee_count` (Number) or `plan` (String) |
66
+
|`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. |
67
+
|`description`| String | Description of the user |
68
+
|`email`| String | Email address of a user |
69
+
|`firstName`| String | First name of a user |
70
+
|`gender`| String | Gender of a user |
71
+
|`id`| String | Unique ID in your database for a user |
72
+
|`lastName`| String | Last name of a user |
73
+
|`name`| String | Full name of a user. If you only pass a first and last name Segment automatically fills in the full name for you. |
74
+
|`phone`| String | Phone number of a user |
75
+
|`title`| String | Title of a user, usually related to their position at a specific company. Example: "VP of Engineering" |
76
+
|`username`| String | User's username. This should be unique to each user, like the usernames of Twitter or GitHub. |
77
+
|`website`| String | Website of a user |
78
+
79
+
80
+
To learn more about using an Identify call to tie custom traits to profiles, [visit Segment's Identify documentation](/docs/connections/spec/identify/).
Copy file name to clipboardExpand all lines: src/unify/Traits/sql-traits.md
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,7 @@ This query computes whether a user has an open ticket:
61
61
wheret.statusin ('pending','open','hold','new')
62
62
```
63
63
64
+
{% include content/trait-types.md %}
64
65
65
66
## Configure SQL Traits
66
67
@@ -71,7 +72,7 @@ To use SQL Traits, you need the following:
71
72
- a user account with access to Unify in that workspace
72
73
73
74
### Step 1. Set up a warehouse source
74
-
75
+
75
76
Segment supports Redshift, Postgres, Snowflake, Azure SQL, and BigQuery as data warehouse sources for SQL Traits. Note that the BigQuery setup process _requires_ a service user.
0 commit comments