@@ -13,7 +13,7 @@ import { getGlobal } from '../src/prebidGlobal.js';
1313// Constants
1414const REAL_TIME_MODULE = 'realTimeData' ;
1515const MODULE_NAME = 'wurfl' ;
16- const MODULE_VERSION = '2.4 .0' ;
16+ const MODULE_VERSION = '2.6 .0' ;
1717
1818// WURFL_JS_HOST is the host for the WURFL service endpoints
1919const WURFL_JS_HOST = 'https://prebid.wurflcloud.com' ;
@@ -50,6 +50,7 @@ const ORTB2_DEVICE_FIELDS = [
5050const ENRICHMENT_TYPE = {
5151 UNKNOWN : 'unknown' ,
5252 NONE : 'none' ,
53+ NONE_LCE : 'none_lce' ,
5354 LCE : 'lce' ,
5455 LCE_ERROR : 'lcefailed' ,
5556 WURFL_PUB : 'wurfl_pub' ,
@@ -76,8 +77,6 @@ const AB_TEST = {
7677 TREATMENT_GROUP : 'treatment' ,
7778 DEFAULT_SPLIT : 0.5 ,
7879 DEFAULT_NAME : 'unknown' ,
79- ENRICHMENT_TYPE_LCE : 'lce' ,
80- ENRICHMENT_TYPE_WURFL : 'wurfl'
8180} ;
8281
8382const logger = prefixLog ( '[WURFL RTD Submodule]' ) ;
@@ -1023,8 +1022,6 @@ const ABTestManager = {
10231022 _enabled : false ,
10241023 _name : null ,
10251024 _variant : null ,
1026- _excludeLCE : true ,
1027- _enrichmentType : null ,
10281025
10291026 /**
10301027 * Initializes A/B test configuration
@@ -1034,8 +1031,6 @@ const ABTestManager = {
10341031 this . _enabled = false ;
10351032 this . _name = null ;
10361033 this . _variant = null ;
1037- this . _excludeLCE = true ;
1038- this . _enrichmentType = null ;
10391034
10401035 const abTestEnabled = params ?. abTest ?? false ;
10411036 if ( ! abTestEnabled ) {
@@ -1044,12 +1039,11 @@ const ABTestManager = {
10441039
10451040 this . _enabled = true ;
10461041 this . _name = params ?. abName ?? AB_TEST . DEFAULT_NAME ;
1047- this . _excludeLCE = params ?. abExcludeLCE ?? true ;
10481042
10491043 const split = params ?. abSplit ?? AB_TEST . DEFAULT_SPLIT ;
10501044 this . _variant = this . _computeVariant ( split ) ;
10511045
1052- logger . logMessage ( `A/B test "${ this . _name } ": user in ${ this . _variant } group (exclude_lce: ${ this . _excludeLCE } ) ` ) ;
1046+ logger . logMessage ( `A/B test "${ this . _name } ": user in ${ this . _variant } group` ) ;
10531047 } ,
10541048
10551049 /**
@@ -1067,24 +1061,12 @@ const ABTestManager = {
10671061 return Math . random ( ) < split ? AB_TEST . TREATMENT_GROUP : AB_TEST . CONTROL_GROUP ;
10681062 } ,
10691063
1070- /**
1071- * Sets the enrichment type encountered in current auction
1072- * @param {string } enrichmentType 'lce' or 'wurfl'
1073- */
1074- setEnrichmentType ( enrichmentType ) {
1075- this . _enrichmentType = enrichmentType ;
1076- } ,
1077-
10781064 /**
10791065 * Checks if A/B test is enabled for current auction
10801066 * @returns {boolean } True if A/B test should be applied
10811067 */
10821068 isEnabled ( ) {
1083- if ( ! this . _enabled ) return false ;
1084- if ( this . _enrichmentType === AB_TEST . ENRICHMENT_TYPE_LCE && this . _excludeLCE ) {
1085- return false ;
1086- }
1087- return true ;
1069+ return this . _enabled ;
10881070 } ,
10891071
10901072 /**
@@ -1168,14 +1150,21 @@ const getBidRequestData = (reqBidsConfigObj, callback, config, userConsent) => {
11681150 const cachedWurflData = getObjectFromStorage ( WURFL_RTD_STORAGE_KEY ) ;
11691151 WurflDebugger . cacheReadStop ( ) ;
11701152
1171- const abEnrichmentType = cachedWurflData ? AB_TEST . ENRICHMENT_TYPE_WURFL : AB_TEST . ENRICHMENT_TYPE_LCE ;
1172- ABTestManager . setEnrichmentType ( abEnrichmentType ) ;
1173-
11741153 // A/B test: Skip enrichment for control group
11751154 if ( ABTestManager . isInControlGroup ( ) ) {
11761155 logger . logMessage ( 'A/B test control group: skipping enrichment' ) ;
1177- enrichmentType = ENRICHMENT_TYPE . NONE ;
1178- bidders . forEach ( bidder => bidderEnrichment . set ( bidder , ENRICHMENT_TYPE . NONE ) ) ;
1156+ const controlEnrichment = cachedWurflData ? ENRICHMENT_TYPE . NONE : ENRICHMENT_TYPE . NONE_LCE ;
1157+ enrichmentType = controlEnrichment ;
1158+ bidders . forEach ( bidder => bidderEnrichment . set ( bidder , controlEnrichment ) ) ;
1159+
1160+ // Read cache metadata for beacon reporting (without enriching bid request)
1161+ if ( cachedWurflData ) {
1162+ wurflId = cachedWurflData . WURFL ?. wurfl_id || '' ;
1163+ samplingRate = cachedWurflData . wurfl_pbjs ?. sampling_rate ?? DEFAULT_SAMPLING_RATE ;
1164+ tier = cachedWurflData . wurfl_pbjs ?. tier ?? '' ;
1165+ overQuota = cachedWurflData . wurfl_pbjs ?. over_quota ?? DEFAULT_OVER_QUOTA ;
1166+ }
1167+
11791168 WurflDebugger . moduleExecutionStop ( ) ;
11801169 callback ( ) ;
11811170 return ;
0 commit comments