Skip to content

Commit

Permalink
IdentityLink check ats after delaySync (prebid#5070)
Browse files Browse the repository at this point in the history
  • Loading branch information
pycnvr authored and iggyfisk committed Jun 22, 2020
1 parent ea6b823 commit c4cdc66
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions modules/identityLinkIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,25 @@ export const identityLinkSubmodule = {
// use protocol relative urls for http or https
const url = `https://api.rlcdn.com/api/identity/envelope?pid=${configParams.pid}${hasGdpr ? '&ct=1&cv=' + gdprConsentString : ''}`;
let resp;
// if ats library is initialised, use it to retrieve envelope. If not use standard third party endpoint
if (window.ats) {
resp = function(callback) {
resp = function(callback) {
// Check ats during callback so it has a chance to initialise.
// If ats library is available, use it to retrieve envelope. If not use standard third party endpoint
if (window.ats) {
window.ats.retrieveEnvelope(function (envelope) {
if (envelope) {
callback(JSON.parse(envelope).envelope);
} else {
getEnvelope(url, callback);
}
});
}
} else {
resp = function (callback) {
} else {
getEnvelope(url, callback);
}
}
};

return {callback: resp};
}
}
};
// return envelope from third party endpoint
function getEnvelope(url, callback) {
ajax(url, response => {
Expand Down

0 comments on commit c4cdc66

Please sign in to comment.