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/alias.md
+26-23Lines changed: 26 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,17 +2,36 @@
2
2
title: 'Spec: Alias'
3
3
---
4
4
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.
7
6
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.
9
9
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:
|`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. |
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:
17
36
18
37
```js
@@ -23,23 +42,15 @@ Here's the payload of a basic Alias call that will associate this user's existin
23
42
}
24
43
```
25
44
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.
27
46
28
47
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:
29
48
30
49
```js
31
50
analytics.alias("507f191e81");
32
51
```
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>
42
52
53
+
{% include content/syntax-note.md %}
43
54
44
55
## Examples
45
56
Here's a complete example of an Alias call:
@@ -66,12 +77,4 @@ Here's a complete example of an Alias call:
66
77
"userId":"507f191e81",
67
78
"version":"1.1"
68
79
}
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.
0 commit comments