1
1
import {
2
2
buildUrl ,
3
- deepAccess , getBidIdParameter ,
3
+ deepAccess , generateUUID , getBidIdParameter ,
4
4
getValue ,
5
5
isArray ,
6
6
isPlainObject ,
@@ -10,6 +10,7 @@ import {
10
10
} from '../src/utils.js' ;
11
11
import { getRefererInfo } from '../src/refererDetection.js' ;
12
12
import { registerBidder } from '../src/adapters/bidderFactory.js' ;
13
+ import { getStorageManager } from '../src/storageManager.js' ;
13
14
import { config } from '../src/config.js' ;
14
15
import { getAllOrtbKeywords } from '../libraries/keywords/keywords.js' ;
15
16
@@ -21,9 +22,11 @@ import {getAllOrtbKeywords} from '../libraries/keywords/keywords.js';
21
22
22
23
const BIDDER_CODE = 'beop' ;
23
24
const ENDPOINT_URL = 'https://hb.beop.io/bid' ;
25
+ const COOKIE_NAME = 'beopid' ;
24
26
const TCF_VENDOR_ID = 666 ;
25
27
26
28
const validIdRegExp = / ^ [ 0 - 9 a - f A - F ] { 24 } $ /
29
+ const storage = getStorageManager ( { bidderCode : BIDDER_CODE } ) ;
27
30
28
31
export const spec = {
29
32
code : BIDDER_CODE ,
@@ -64,6 +67,19 @@ export const spec = {
64
67
const kwdsFromRequest = firstSlot . kwds ;
65
68
let keywords = getAllOrtbKeywords ( bidderRequest . ortb2 , kwdsFromRequest ) ;
66
69
70
+ let beopid = '' ;
71
+ if ( storage . cookiesAreEnabled ) {
72
+ beopid = storage . getCookie ( COOKIE_NAME , undefined ) ;
73
+ if ( ! beopid ) {
74
+ beopid = generateUUID ( ) ;
75
+ let expirationDate = new Date ( ) ;
76
+ expirationDate . setTime ( expirationDate . getTime ( ) + 86400 * 183 * 1000 ) ;
77
+ storage . setCookie ( COOKIE_NAME , beopid , expirationDate . toUTCString ( ) ) ;
78
+ }
79
+ } else {
80
+ storage . setCookie ( COOKIE_NAME , '' , 0 ) ;
81
+ }
82
+
67
83
const payloadObject = {
68
84
at : new Date ( ) . toString ( ) ,
69
85
nid : firstSlot . nid ,
@@ -74,6 +90,7 @@ export const spec = {
74
90
lang : ( window . navigator . language || window . navigator . languages [ 0 ] ) ,
75
91
kwds : keywords ,
76
92
dbg : false ,
93
+ fg : beopid ,
77
94
slts : slots ,
78
95
is_amp : deepAccess ( bidderRequest , 'referrerInfo.isAmp' ) ,
79
96
gdpr_applies : gdpr ? gdpr . gdprApplies : false ,
0 commit comments