|
| 1 | +--- |
| 2 | +title: Identity Resolution Settings |
| 3 | +--- |
| 4 | +# Setting Up Identity Graph Rules |
| 5 | +Before connecting a source to a Personas space, we recommend first reviewing our default Identity settings and configuring custom rules as needed. Updates to configurations will only be applied to all new data flowing through the space after the changes have been saved. Thus, if this is your first time setting up your Identity Graph, we recommend getting started with a *Dev* space [here](/docs/src/personas/identity-resolution/personas-space-set-up.md). |
| 6 | + |
| 7 | +> note "" |
| 8 | +> **Note:** The Identity Resolution table can only be edited by workspace owners and users with the Identity Admin role. |
| 9 | +
|
| 10 | +## ExternalIDs |
| 11 | +Segment creates and merges user profiles based on externalIDs we use as identifiers. You can view these externalIDs in the Identities tab of a User Profile in the User Explorer: |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +By default, Segment promotes the following traits and IDs in track and identify calls to be used as externalIDs: |
| 16 | + |
| 17 | +| External ID Type | Message Location in Track or Identify Call | |
| 18 | +| ------------------ | ------------------------------------------------------------------------------------------------------------- | |
| 19 | +| user_id | userId | |
| 20 | +| email | traits.email or context.traits.email | |
| 21 | +| android.id | context.device.id when context.device.type = 'android' | |
| 22 | +| android.idfa | context.device.advertisingId when context.device.type = 'android' AND context.device.adTrackingEnabled = true | |
| 23 | +| android.push_token | context.device.token when context.device.type = 'android' | |
| 24 | +| anonymous_id | anonymousId | |
| 25 | +| cross_domain_id | cross_domain_id | |
| 26 | +| ga_client_id | context.integrations['Google Analytics'].clientId when explicitly captured by users | |
| 27 | +| group_id | groupId | |
| 28 | +| ios.id | context.device.id when context.device.type = 'ios' | |
| 29 | +| ios.idfa | context.device.advertisingId when context.device.type = 'ios' AND context.device.adTrackingEnabled = true | |
| 30 | +| ios.push_token | context.device.token when context.device.type = 'ios' | |
| 31 | + |
| 32 | +You'll notice that these identifiers have the *Provided by Segment* label next to it under *Identifier Type*. |
| 33 | + |
| 34 | +To create your own custom externalID, click on *Add Identifier*. |
| 35 | + |
| 36 | +These custom identifiers must be sent in the custom `externalIds` in the `context` object of any call to our API. The four fields below (id, type, collection, encoding) are all required: |
| 37 | + |
| 38 | +| Key | Value | |
| 39 | +| ---------- | ---------------------------------------------------------------------------- | |
| 40 | +| id | value of the externalID | |
| 41 | +| type | name of externalID type (`app_id`, `ecommerce_id`, `shopify_id`, etc) | |
| 42 | +| collection | `users` if a user-level identifier or `accounts` if a group-level identifier | |
| 43 | +| encoding | `none` | |
| 44 | + |
| 45 | +The following example payload adds a custom `phone` externalID type: |
| 46 | + |
| 47 | +``` js |
| 48 | +analytics.track('Subscription Upgraded', { |
| 49 | + plan: 'Pro', |
| 50 | + mrr: 99.99 |
| 51 | +}, { |
| 52 | + externalIds: [ |
| 53 | + { |
| 54 | + id: '123-456-7890', |
| 55 | + type: 'phone', |
| 56 | + collection: 'users', |
| 57 | + encoding: 'none' |
| 58 | + } |
| 59 | + ] |
| 60 | +}) |
| 61 | +``` |
| 62 | +We recommend adding custom externalIDs to the Identity Resolution table *before* events containing this identifier flow through the space. Once an event with a new type of externalID flows into the space, the externalID will automatically be added to the table if it wasn't manually added. However, when the externalID is automatically added, it will default to our preset priority and limit, as explained below. |
| 63 | + |
| 64 | +## Flat Matching Logic |
| 65 | +When a new event flows into Personas, we look for any profiles that match any of the identifiers on the event. |
| 66 | + |
| 67 | +There are three cases that can occur: |
| 68 | + |
| 69 | +**Case One: Create New Profile** |
| 70 | +When there are no pre-existing profiles that have matching identifiers to the event, we create a new user profile. |
| 71 | + |
| 72 | +**Case Two: Add Event to Existing Profile** |
| 73 | +When there is only one profile that matches all identifiers in an event, we attempt to map the traits, identifiers and events on the call to that existing profile. If there is an excess of any identifier on the final profile, we defer to our merge protection rules outlined below. |
| 74 | + |
| 75 | +**Case Three: Merge Existing Profiles** |
| 76 | +When there are multiple profiles that match the identifiers in an event, we attempt to merge profiles and first check our merge protection rules as outlined below. |
| 77 | + |
| 78 | +## Merge Protection Rules |
| 79 | +Identity Admins should review and configure the merge protection rules in the Identity Resolution Settings page to protect the identity graph from inaccurate merges. |
| 80 | + |
| 81 | +One common example of a use-case that can cause inaccurate merges is the Shared iPad setup. For example, many companies now have iPads available in-store for customers to register for an account or submit order information. If different users submit information on the same device, there will now be multiple events sent with the same deviceID. Without merge protection rules in place, we might see all these different users merged into the same user profile based on this common identifier. |
| 82 | + |
| 83 | +Our three merge protection rules allow Identity Admins to block incorrect values from causing incorrect merges, to set the maximum number of values allowed per externalID, and to customize the priority of these externalIDs. |
| 84 | + |
| 85 | +### Blocked Values |
| 86 | +We recommend proactively blocking certain values from ever been used as identifiers. While these values will remain in the payload on the event itself, it will not be promoted to the externalID object Segment uses to determine user profiles. |
| 87 | + |
| 88 | +This is extremely important when developers have a hard-coded value for fields like user_id during QA or development that then erroneously makes it production. This can cause hundreds of profiles to merge incorrectly and can have costly consequences when these spaces are already feeding data into a production email marketing tool or push notification tool downstream. |
| 89 | + |
| 90 | +In the past, we've seen certain default values across many different customers cause mass amounts of profiles to merge incorrectly. Segment suggests that for every externalID, customers opt into automatically blocking the following suggested values: |
| 91 | + |
| 92 | +| Value | Type | |
| 93 | +| ----------------------------- | --------------- | |
| 94 | +| Zeroes and Dashes (`^[0\-]*$) | Pattern (REGEX) | |
| 95 | +| -1 | Exact Match | |
| 96 | +| null | Exact Match | |
| 97 | +| anonymous | Exact Match | |
| 98 | + |
| 99 | +Before sending data through, we also recommend adding any default hard-coded values that your team uses during the development process. In the UI today, the Identity Admin can add blocks against only exact matches to the inputted value. |
| 100 | + |
| 101 | +However, we currently have Limited Availability for a feature that allows customers to create custom REGEX blockers as well. This can be useful for cases where an externalID was incorrectly implemented. To enable this, please reach out to your customer success manager. |
| 102 | + |
| 103 | +### Limit |
| 104 | + |
| 105 | +Identity Admins can specify the total number of values allowed per externalID type on a profile. This will vary depending on how companies define a user today. In most cases, companies rely on `user_id` to distinguish user profiles and Segment recommends the following default configurations: |
| 106 | + |
| 107 | +| ExternalID | Limit | |
| 108 | +| --------------------- | ----- | |
| 109 | +| user_id | 1 | |
| 110 | +| all other identifiers | 5 | |
| 111 | + |
| 112 | +There are specific cases that will deviate from this default. For example, a case where a user can have more than one user_id but only one email, like when a user is defined by both their shopify_id and an internal UUID. In this case, an example setup may be: |
| 113 | + |
| 114 | +| ExternalID | Limit | |
| 115 | +| --------------------- | ----- | |
| 116 | +| email | 1 | |
| 117 | +| user_id | 2 | |
| 118 | +| all other identifiers | 5 | |
| 119 | + |
| 120 | +We offer a Limited Availability release of a new type of limit called "Time-Based Limits". These limits allow any profile to have a specified limit of values within a certain time range. This is particularly useful for `externalIDs` such as `anonymousID` and `ga_client_id` which are constantly renewed and collected over a lifetime. We know that customers can easily collect over 100 `anonymous_ids` over a few years of app usage. However, rather than setting the absolute limit of `anonymous_ids` to 100, we can now create a sliding range that intelligently gates how many `anonymous_ids` any user should reasonably collect within a specific time period. |
| 121 | + |
| 122 | +### Priority |
| 123 | + |
| 124 | +The priority of an identifier is taken into consideration once we exceed the limit of any identifier on the final profile. |
| 125 | + |
| 126 | +Let's take as an example a Personas space with the following Identity Resolution configurations: |
| 127 | + |
| 128 | +| ExternalID | Limit | Priority | |
| 129 | +| ------------ | ----- | -------- | |
| 130 | +| user_id | 1 | 1 | |
| 131 | +| email | 5 | 2 | |
| 132 | +| anonymous_id | 5 | 3 | |
| 133 | + |
| 134 | +A profile already exists with user_id `abc123` and email `[email protected]`. A new event comes in with new user_id `abc456` but the same email `[email protected]`. If we mapped this event to this profile, the resulting profile would then contain two user_ids and one email. Given that user_id has a limit of 1, we've now exceeded the limit of an identifier so check the priority of these identifiers. Because email and user_id are the only two identifiers on the event and email is ranked lower than user_id, we demote email as an identifier on the incoming event and try again. |
| 135 | + |
| 136 | +At this point, the event searches for any profiles that match just the identifier user_id `abc456`. Now there are no existing profiles with this identifier, so a new profile is created with user_id `abc456`. |
| 137 | + |
| 138 | +By default, we explicitly order user_id and email as rank `1` and `2`, respectively. All other identifiers are in alphabetical order beginning from rank `3`. This means that if the only identifiers ever sent in on events flowing into personas are user_id, email, anonymous_id and ga_client_id, the rank would be as follows: |
| 139 | + |
| 140 | +| ExternalID | Priority | |
| 141 | +| ------------ | -------- | |
| 142 | +| user_id | 1 | |
| 143 | +| email | 2 | |
| 144 | +| anonymous_id | 3 | |
| 145 | +| ga_client_id | 4 | |
| 146 | + |
| 147 | +If a new android.id identifier appeared without first giving it explicit order, the order would automatically reshuffle to: |
| 148 | + |
| 149 | +| ExternalID | Priority | |
| 150 | +| ------------ | -------- | |
| 151 | +| user_id | 1 | |
| 152 | +| email | 2 | |
| 153 | +| android.id | 3 | |
| 154 | +| anonymous_id | 4 | |
| 155 | +| ga_client_id | 5 | |
| 156 | + |
| 157 | +Thus, if you require an explicit order for all identifiers, configure this in the Identity Resolution settings page before sending in events. |
0 commit comments