Skip to content

Commit 19ffd6c

Browse files
committed
Update alias.md
1 parent a3b692e commit 19ffd6c

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

src/connections/spec/alias.md

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,36 @@
22
title: 'Spec: Alias'
33
---
44

5-
> note "Alias is an advanced method"
6-
> The Alias method allows you to explicitly change the ID of a tracked user, however this should only be done when it's required for downstream destination compatibility. See the [Best Practices for Identifying Users](/docs/guides/how-to-guides/best-practices-identify/) docs for more information.
5+
The Alias method is used to merge two unassociated user identities, effectively connecting two sets of user data as one. This is an advanced method, but it is required to manage user identities successfully in some of Segment's destinations. Segment usually handles aliasing automatically when you call Identify on a user, however some tools require an explicit Alias call.
76

8-
The `alias` method is used to merge two user identities, effectively connecting two sets of user data as one. This is an advanced method, but it is required to manage user identities successfully in some of Segment's destinations.
7+
> info "Alias is an advanced method"
8+
> The Alias method allows you to explicitly change the ID of a tracked user. This should only be done when it's required for downstream destination compatibility. See the [Best Practices for Identifying Users](/docs/guides/how-to-guides/best-practices-identify/) docs for more information.
99
10-
Since this is Segment's most advanced method, there are sections on each docs page for destinations that use it:
10+
<!-- Since this is Segment's most advanced method, there are sections on each docs page for destinations that use it:
1111
1212
- [Kissmetrics](/docs/connections/destinations/catalog/kissmetrics#alias)
1313
- [Mixpanel](/docs/connections/destinations/catalog/mixpanel#alias)
1414
- [Vero](/docs/connections/destinations/catalog/vero#alias)
1515
16+
TODO: ask if these are the only destinations that use it/if it is REQUIRED for any destination to use this method --->
17+
18+
## Syntax
19+
20+
The Alias call has the following fields:
21+
22+
| Field | | Type | Description |
23+
| ------------ | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
24+
| `userId` | | String | The `userId` is a string that will be the user's new identity, or an existing identity that you wish to merge with the `previousId`. See the [User ID docs](/docs/connections/spec/identify#user-id) for more detail. |
25+
| `previousId` | optional | String | The `previousId` is the existing ID you've referred to the user by. It might be an Anonymous ID assigned to that user or a User ID you previously identified them with using Segment's [Identify](/docs/connections/spec/identify/) call. |
26+
| `options` | optional | Object | A dictionary of options. For example, [enable or disable specific destinations](#managing-data-flow-with-the-integrations-object) for the call. |
27+
| `callback` | optional | Function | A function that is executed after a timeout of 300 ms, giving the browser time to make outbound requests first. |
28+
29+
The Alias method follows the format below:
30+
31+
```js
32+
analytics.alias(userId, [previousId], [options], [callback]);
33+
```
34+
1635
Here's the payload of a basic Alias call that will associate this user's existing `id` (email address) with a new one (a database ID), with most [common fields](/docs/connections/spec/common/) removed:
1736

1837
```js
@@ -23,23 +42,15 @@ Here's the payload of a basic Alias call that will associate this user's existin
2342
}
2443
```
2544

26-
If you're instrumenting a website, then the Anonymous ID is generated in the browser so you must call `alias` from the client-side. If you're using a server-side session ID as the Anonymous ID, then you must alias from the server-side.
45+
If you're instrumenting a website, the Anonymous ID is generated in the browser so you must call Alias from the client-side. If you're using a server-side session ID as the Anonymous ID, then you must Alias from the server-side.
2746

2847
Here's the corresponding JavaScript event that would generate the above payload. If you're using Segment's JavaScript library, Segment automatically passes in the user's `anonymousId` as `previousId` for you:
2948

3049
```js
3150
analytics.alias("507f191e81");
3251
```
33-
{% include content/syntax-note.md %}
34-
35-
Beyond the common fields, the Alias call takes the following fields:
36-
37-
<table>
38-
{% include content/spec-table-header.md %}
39-
{% include content/spec-field-previous-id.md %}
40-
{% include content/spec-field-user-id.md %}
41-
</table>
4252

53+
{% include content/syntax-note.md %}
4354

4455
## Examples
4556
Here's a complete example of an Alias call:
@@ -66,12 +77,4 @@ Here's a complete example of an Alias call:
6677
"userId": "507f191e81",
6778
"version": "1.1"
6879
}
69-
```
70-
71-
## Previous ID
72-
73-
The `previousId` is the existing ID you've referred to the user by. It might be an Anonymous ID assigned to that user or a User ID you previously identified them with using Segment's [Identify](/docs/connections/spec/identify/) call.
74-
75-
## User ID
76-
77-
The `userId` is a string that will be the user's new identity, or an existing identity that you wish to merge with the `previousId`. See the [User ID docs](/docs/connections/spec/identify#user-id) for more detail.
80+
```

0 commit comments

Comments
 (0)