How does the Alias ID Event Work?

Below you will learn how to understand and install the alias ID event.

Applies to: Brands and Agencies

The Alias ID event is an optional advanced Ad Analytics event designed to assist by providing more context around your data. This event does require advanced knowledge about your systems.

By default, Spotify Ad Analytics only provides data in an aggregated, anonymized format. An Alias event can be used to match Spotify Ad Analytics' internal cookie ID with your own hashed internal user IDs. This will allow you to match back the conversions we attribute with your internal systems. 

To turn on your Alias ID event, head to your Manage tab > Your Pixels > click on the "+" sign under Alias > toggle on and input your hashed internal user ID > click Save Pixel.

    • We recommend inputting a hashed internal user ID, because when it is hashed, you aren't sending over any PII. This way, only your internal team can match back. 
    • If it isn't hashed and you use UIDs that is okay, but we don't recommend sending over usernames or email addresses. 

Once you turn it on, your Verified Event scripts will update to include the Alias ID code. If you are editing your already placed script, the general placement for the Alias ID event is after the line with your Pixel Key ID and before the line where the conversion event is stated. See the example script below. 

<script>
// Installation script generated by Ad Analytics
(function(w, d){
var id='spdt-capture', n='script';
if (!d.getElementById(id)) {
w.spdt =
w.spdt ||
function() {
(w.spdt.q = w.spdt.q || []).push(arguments);
};
var e = d.createElement(n); e.id = id; e.async=1;
e.src = 'https://pixel.byspotify.com/ping.min.js';
var s = d.getElementsByTagName(n)[0];
s.parentNode.insertBefore(e, s);
}
w.spdt('conf', { key: '5a1c965e567a45f7832cc5ba7a37faf7' });
// Dynamically populate alias from session data
w.spdt('alias', { id: $user_id, email: $user_email });
w.spdt('purchase', {
order_id: '', // Dynamically populate from session data
discount_code: '', // Dynamically populate from session data
is_new_customer: '', // Dynamically populate from session data
value: '', // Dynamically populate from session data
currency: '',
});
})(window, document);
</script>

If you are not using the platform-generated scripts (Verified Events Table), include your hashed internal ID within the "id" field within the alias event script and Spotify Ad Analytics will send encrypted data.

spdt('alias', {
id: 'hashed internal ID',});

Email Addresses

If you want to use email addresses in conjunction with an ID or as a standalone identifier, you can send them in one of two ways.

spdt('alias', {email: "jane@example.com"})

The Spotify Pixel does not capture the raw email address. Instead, the SDK will create a SHA256 hash of the email client side before data is transmitted to the Spotify Pixel service.

If you prefer to SHA256 hash the email yourself, you can send the hashed value as such:

spdt('alias', {
email: "8c87b489ce35cf2e2f39f80e282cb2e804932a56a213983eeeb428407d43b52d"
})