Skip to content

Commit 2861f74

Browse files
committed
Merge branch 'develop' into page-spec
2 parents e77787d + 8e9a667 commit 2861f74

File tree

1 file changed

+27
-20
lines changed

1 file changed

+27
-20
lines changed

src/connections/spec/alias.md

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,37 @@
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 our [Best Practices for Identifying Users](/docs/guides/how-to-guides/best-practices-identify/) for more information.
5+
The Alias method is an advanced method used to merge 2 unassociated user identities, effectively connecting 2 sets of user data in one profile.
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 our 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-
> info "Alias and Unify"
11-
> The alias call can't be used to merge profiles in [Unify](/docs/unify/). For more information on how Unify merges user profiles, see the documentation on [Identity Resolution](/docs/unify/identity-resolution/).
12-
13-
{% include components/reference-button.html href="https://university.segment.com/introduction-to-segment/324252?reg=1&referrer=docs" icon="media/academy.svg" title="Segment University: The Segment Methods" content="Check out our high-level overview of these APIs in Segment University. (Must be logged in to access.)" %}
14-
15-
Since this is our most advanced method we have added sections to 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:
1611
1712
- [Kissmetrics](/docs/connections/destinations/catalog/kissmetrics#alias)
1813
- [Mixpanel](/docs/connections/destinations/catalog/mixpanel#alias)
1914
- [Vero](/docs/connections/destinations/catalog/vero#alias)
2015
21-
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:
16+
TODO: do more research on if this is required anywhere anymore. --->
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+
35+
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:
2236

2337
```js
2438
{
@@ -28,26 +42,19 @@ Here's the payload of a basic `alias` call that will associate this user's exist
2842
}
2943
```
3044

31-
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.
32-
3345
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:
3446

3547
```js
3648
analytics.alias("507f191e81");
3749
```
38-
{% include content/syntax-note.md %}
3950

40-
Beyond the common fields, the `alias` call takes the following fields:
51+
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 call Alias from the server-side.
4152

42-
<table>
43-
{% include content/spec-table-header.md %}
44-
{% include content/spec-field-previous-id.md %}
45-
{% include content/spec-field-user-id.md %}
46-
</table>
4753

54+
{% include content/syntax-note.md %}
4855

4956
## Examples
50-
Here's a complete example of an `alias` call:
57+
Here's a complete example of an Alias call:
5158

5259
```js
5360
{

0 commit comments

Comments
 (0)