From 54e5cb1d5a56895547f83b3645e43d7861c72945 Mon Sep 17 00:00:00 2001 From: Mike Lei Date: Fri, 27 Oct 2023 06:55:15 -0700 Subject: [PATCH] Flipp Bid Adapter: add additional check for userKey value, update docs (#10628) * Flipp Bid Adapter: initial release * Added flippBidAdapter * OFF-372 Support DTX/Hero in flippBidAdapter (#2) * support creativeType * OFF-422 flippBidAdapter handle AdTypes --------- Co-authored-by: Jairo Panduro * OFF-465 Add getUserKey logic to prebid.js adapter (#3) * Support cookie sync and uid * address pr feedback * remove redundant check * OFF-500 Support "startCompact" param for Prebid.JS #4 * set startCompact default value (#5) * fix docs * use client bidding endpoint * update unit testing endpoint * OFF-876 [Prebid Adapter] Check userKey for empty string (#6) * add more checks to userKey * update document * add uuid format statement * modify docs --------- Co-authored-by: Jairo Panduro --- modules/flippBidAdapter.js | 15 +++++++++------ modules/flippBidAdapter.md | 5 +++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/modules/flippBidAdapter.js b/modules/flippBidAdapter.js index dfe8141170d..480e414992d 100644 --- a/modules/flippBidAdapter.js +++ b/modules/flippBidAdapter.js @@ -25,13 +25,16 @@ export function getUserKey(options = {}) { } // If the partner provides the user key use it, otherwise fallback to cookies - if (options.userKey && isValidUserKey(options.userKey)) { - userKey = options.userKey; - return options.userKey; + if ('userKey' in options && options.userKey) { + if (isValidUserKey(options.userKey)) { + userKey = options.userKey; + return options.userKey; + } } + // Grab from Cookie - const foundUserKey = storage.cookiesAreEnabled() && storage.getCookie(FLIPP_USER_KEY); - if (foundUserKey) { + const foundUserKey = storage.cookiesAreEnabled(null) && storage.getCookie(FLIPP_USER_KEY, null); + if (foundUserKey && isValidUserKey(foundUserKey)) { return foundUserKey; } @@ -47,7 +50,7 @@ export function getUserKey(options = {}) { } function isValidUserKey(userKey) { - return !userKey.startsWith('#'); + return typeof userKey === 'string' && !userKey.startsWith('#') && userKey.length > 0; } const generateUUID = () => { diff --git a/modules/flippBidAdapter.md b/modules/flippBidAdapter.md index 810b883e3f9..e823432a60f 100644 --- a/modules/flippBidAdapter.md +++ b/modules/flippBidAdapter.md @@ -32,9 +32,10 @@ var adUnits = [ publisherNameIdentifier: 'wishabi-test-publisher', // Required siteId: 1192075, // Required zoneIds: [260678], // Optional - userKey: "", // Optional + userKey: ``, // Optional, but recommended for better user experience. Can be a cookie, session id or any other user identifier options: { - startCompact: true // Optional, default to true + startCompact: true, // Optional. Height of the experience will be reduced. Default to true + dwellExpand: true // Optional. Auto expand the experience after a certain time passes. Default to true } } }