This sample JavaScript is where a matched Identity event occurs when a user logs in to a website.
<script type="text/javascript">
function getuserId()
{
// Fill in this function to retrieve and return the client user id
from the page
return null;
}
try
{
var USER_ID = getuserId();
if (USER_ID)
{
var DSP_PIXEL_URL = "{Replace with DSP ID Sync Pixel URL}";
var DSP_NAME = "{Replace with DSP Name}";
var DSP_UUID ="{Replace with DSP UUID Name}";
var USER_ID_Name = "{Replace with Partner User ID Name}";
var UBX_HOST = "{Replace with UBX Host Name}";
var AUTHKEY = "{Replace with UBX DSP Endpoint Auth Key}";
//UBX URL Format is
https://{UBX_HOST}/v1/customevent/matchedIdentity/{AUTHKEY}/DSPID_{DSP_NAME}
={DSP_UUID}/{USER_ID_Name}={USER_ID}
var UBX_CALLBACK_URL = encodeURIComponent("https://"+UBX_HOST+"
/v1/customevent/matchedIdentity/"+AUTHKEY+"/DSPID_"+DSP_NAME+"=") +
DSP_UUID + encodeURIComponent
("/"+USER_ID_Name+"="+USER_ID);
var DSP_FINAL_CALLBACK_URL = DSP_PIXEL_URL + UBX_CALLBACK_URL;
new Image().src = DSP_FINAL_CALLBACK_URL;
}
}
catch (err) {
console.log('Error:'+err.message);
}
</script>