Segment.alias()

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 integrations.

Usage

Hover over inputs/exits for more info.

var Segment = require('machinepack-segment');


// Merge two user identities, effectively connecting two sets of user data as one.

Segment.alias({

writeKey: 'C3ut91L4284abn2VdaJ2813Zc193042Kl4',

sourceUserId: '019mr8mf4r',

destinationUserId: '439z31jrq1',

integrations: {},

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function () {

 

},

});

Inputs

writeKey required

The "write key" associated with your Segment account.

'C3ut91L4284abn2VdaJ2813Zc193042Kl4'
sourceUserId required

The existing id you've identified this user with previously.

'019mr8mf4r'
destinationUserId required

A unique id which references either a new or a different pre-existing identity that user data in Segment should be merged into.

'439z31jrq1'
integrations

A dictionary of Segment integrations to either enable or disable.

Exits

error

An unexpected error occurred.

success

OK.