Identify


The identify method lets you send custom data to all your installed apps to identify your users.

stackpile.analytics.identify(id, [data], [settings], callback);
Parameter Required Description
id Yes An Id that uniquely identifies the user in your application. This can be a number 100029 or an email address [email protected]. This Id should be something that never changes for a user.
data No An object containing the custom data you would like to send with the identify event. Data can be sent to all installed apps, or individual apps, for example mixpanel or heap. See examples below for more info.
settings No An object containing Stackpile specific options. Currently only supports timeout and only. Use the timeout setting to set the timeout duration before the callback function is called. If you only need to send an event to specific apps in your stack, use the only setting. For example: only: ['mixpanel', 'keenio']
callback No A function that is called after the set timeout. Can be used if you need to wait before continuing with a process on your page."

Examples


A few examples of how you can use identify to send custom people data to your installed apps:

stackpile.analytics.identify('100029', {
    all: {
        name: 'Joe Smith',
        email: '[email protected]'
    },
    mixpanel: {
        created: 1458309881
    }
});

This will send the id, name and email to all installed apps and $created to Mixpanel.

You can use the following custom data properties to send data to selected apps:

Property App
all All installed apps
amplitude Amplitude
castle Castle
customerio Customer.io
firstpromoter FirstPromoter
googleanalytics Google Analytics
gosquared GoSquared
heap Heap
kissmetrics Kissmetrics
logrocket LogRocket
mixpanel Mixpanel
optimizely Optimizely
webengage WebEngage
woopra Woopra
wootric Wootric

onReady


Because our scripts are loaded asynchronous, you could run into an issue when trying to send identify events as soon as the page loads if the API is not ready yet. The onReady event is a callback function that lets you know when the Stackpile Unified Analytics API is ready.

(_stackpile = window._stackpile || []).push(['onReady', onSPReady]);
function onSPReady() {
    // Code that will be fired as soon as 
    // the API is ready. For example:

    stackpile.analytics.identify('155001', {
        all: {
            name: 'Paul Smith',
            email: '[email protected]'
        });
}

Customer.io


Customer.io requires the id, email and created_at properties to be set when identifying a user. If you don't want to set email and created_at for all your integrations you can customize the properties sent to the identify method. For example:

stackpile.analytics.identify('100132', {
    all: {
        name: 'Sam Stone',
        email: '[email protected]'
    },
    customerio: {
        created_at: 1339438758
    }
});

FirstPromoter


FirstPromoter requires the uid and email properties to be set when identifying a user. If you don't want to set uid and email for all your integrations you can customize the properties sent to the identify method. For example:

stackpile.analytics.identify('100132', {
    all: {
        name: 'Sam Stone',
        email: '[email protected]'
    },
    firstpromoter: {
        uid: '123456789'
    }
});

Mixpanel


Mixpanel has a few special properties available to identify a person. We automatically transform the email, created and name properties to the special properties if they are set.

Property Mixpanel Property
email $email
created $created
name $name

Woopra


Woopra requires an email property to be set to identify the user. If no email property is present, we will default to the id.

Wootric


Wootric requires an email property to be set to identify the user. If no email property is present, we will default to the id.

Wootric will be triggered as soon as the identify call is made.