Skip to content

Commit 54e5cb1

Browse files
Flipp Bid Adapter: add additional check for userKey value, update docs (prebid#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 <[email protected]> * 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 <[email protected]>
1 parent f40a324 commit 54e5cb1

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

modules/flippBidAdapter.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@ export function getUserKey(options = {}) {
2525
}
2626

2727
// If the partner provides the user key use it, otherwise fallback to cookies
28-
if (options.userKey && isValidUserKey(options.userKey)) {
29-
userKey = options.userKey;
30-
return options.userKey;
28+
if ('userKey' in options && options.userKey) {
29+
if (isValidUserKey(options.userKey)) {
30+
userKey = options.userKey;
31+
return options.userKey;
32+
}
3133
}
34+
3235
// Grab from Cookie
33-
const foundUserKey = storage.cookiesAreEnabled() && storage.getCookie(FLIPP_USER_KEY);
34-
if (foundUserKey) {
36+
const foundUserKey = storage.cookiesAreEnabled(null) && storage.getCookie(FLIPP_USER_KEY, null);
37+
if (foundUserKey && isValidUserKey(foundUserKey)) {
3538
return foundUserKey;
3639
}
3740

@@ -47,7 +50,7 @@ export function getUserKey(options = {}) {
4750
}
4851

4952
function isValidUserKey(userKey) {
50-
return !userKey.startsWith('#');
53+
return typeof userKey === 'string' && !userKey.startsWith('#') && userKey.length > 0;
5154
}
5255

5356
const generateUUID = () => {

modules/flippBidAdapter.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ var adUnits = [
3232
publisherNameIdentifier: 'wishabi-test-publisher', // Required
3333
siteId: 1192075, // Required
3434
zoneIds: [260678], // Optional
35-
userKey: "", // Optional
35+
userKey: ``, // Optional, but recommended for better user experience. Can be a cookie, session id or any other user identifier
3636
options: {
37-
startCompact: true // Optional, default to true
37+
startCompact: true, // Optional. Height of the experience will be reduced. Default to true
38+
dwellExpand: true // Optional. Auto expand the experience after a certain time passes. Default to true
3839
}
3940
}
4041
}

0 commit comments

Comments
 (0)