-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Rubicon analytics v2 #5698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rubicon analytics v2 #5698
Changes from 1 commit
33ecab2
ebe5d8c
0c88c49
c72cd54
2161cc1
57195c2
ab19c72
3b112a4
dbe91ce
490757f
aa0197f
3be5987
a0996e5
9f6bb95
524a2aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,8 @@ const cache = { | |
gpt: {}, | ||
}; | ||
|
||
const BID_REJECTED_IPF = 'rejected-ipf'; | ||
|
||
export function getHostNameFromReferer(referer) { | ||
try { | ||
rubiconAdapter.referrerHostname = utils.parseUrl(referer, {noDecodeWholeURL: true}).hostname; | ||
|
@@ -368,7 +370,7 @@ function setRubiconAliases(aliasRegistry) { | |
} | ||
|
||
function getRpaCookie() { | ||
let encodedCookie = storage.getCookie(COOKIE_NAME); | ||
let encodedCookie = storage.getDataFromLocalStorage(COOKIE_NAME); | ||
if (encodedCookie) { | ||
try { | ||
return JSON.parse(window.atob(encodedCookie)); | ||
|
@@ -381,7 +383,7 @@ function getRpaCookie() { | |
|
||
function setRpaCookie(decodedCookie) { | ||
try { | ||
storage.setCookie(COOKIE_NAME, window.btoa(JSON.stringify(decodedCookie))); | ||
storage.setDataInLocalStorage(COOKIE_NAME, window.btoa(JSON.stringify(decodedCookie))); | ||
} catch (e) { | ||
utils.logError(`Rubicon Analytics: Unable to encode ${COOKIE_NAME} value: `, e); | ||
} | ||
|
@@ -480,6 +482,7 @@ let rubiconAdapter = Object.assign({}, baseAdapter, { | |
disableAnalytics() { | ||
this.getUrl = baseAdapter.getUrl; | ||
accountId = null; | ||
cache.gpt.registered = false; | ||
baseAdapter.disableAnalytics.apply(this, arguments); | ||
}, | ||
track({eventType, args}) { | ||
|
@@ -499,11 +502,12 @@ let rubiconAdapter = Object.assign({}, baseAdapter, { | |
cacheEntry.floorData = {...floorData}; | ||
} | ||
cacheEntry.gdprConsent = utils.deepAccess(args, 'bidderRequests.0.gdprConsent'); | ||
cacheEntry.session = storage.cookiesAreEnabled() && updateRpaCookie(); | ||
cacheEntry.session = storage.localStorageIsEnabled() && updateRpaCookie(); | ||
cache.auctions[args.auctionId] = cacheEntry; | ||
// register to listen to gpt events if not done yet | ||
if (!cache.gpt.registered && utils.isGptPubadsDefined()) { | ||
subscribeToGamSlots(); | ||
cache.gpt.registered = true; | ||
} | ||
break; | ||
case BID_REQUESTED: | ||
|
@@ -608,7 +612,7 @@ let rubiconAdapter = Object.assign({}, baseAdapter, { | |
delete bid.error; // it's possible for this to be set by a previous timeout | ||
break; | ||
case NO_BID: | ||
bid.status = args.status === BID_REJECTED ? 'rejected-ipf' : 'no-bid'; | ||
bid.status = args.status === BID_REJECTED ? BID_REJECTED_IPF : 'no-bid'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but we can fix this later. for now this is ok |
||
delete bid.error; | ||
break; | ||
default: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is
cache.gpt.registered
set totrue
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is not, must have left it out or removed it accidentally! Thanks, good catch!