@@ -188,6 +188,7 @@ export function GoogleTagServicesGpt(source) {
188188 let clickUrl = '' ;
189189 let collapseEmptyDiv = null ;
190190 const services = new Set ( ) ;
191+ const config = { } ;
191192 const slot = {
192193 addService ( e ) {
193194 services . add ( e ) ;
@@ -211,6 +212,21 @@ export function GoogleTagServicesGpt(source) {
211212 getCategoryExclusions : ( ) => Array . from ( exclusions ) ,
212213 getClickUrl : ( ) => clickUrl ,
213214 getCollapseEmptyDiv : ( ) => collapseEmptyDiv ,
215+ getConfig : ( keys ) => {
216+ const configKeys = Array . isArray ( keys ) ? keys : [ keys ] ;
217+ const googleTagServicesConfig = { } ;
218+ for ( let i = 0 ; i < configKeys . length ; i += 1 ) {
219+ const key = configKeys [ i ] ;
220+ if ( key === 'clickUrl' ) {
221+ googleTagServicesConfig [ key ] = clickUrl ;
222+ } else if ( key === 'targeting' ) {
223+ googleTagServicesConfig [ key ] = targeting ;
224+ } else {
225+ googleTagServicesConfig [ key ] = config [ key ] ;
226+ }
227+ }
228+ return Object . freeze ( googleTagServicesConfig ) ;
229+ } ,
214230 getContentUrl : ( ) => '' ,
215231 getDivStartsCollapsed : ( ) => null ,
216232 getDomId : ( ) => optDiv ,
@@ -249,6 +265,25 @@ export function GoogleTagServicesGpt(source) {
249265 collapseEmptyDiv = ! ! v ;
250266 return slot ;
251267 } ,
268+ setConfig ( obj ) {
269+ try {
270+ const entries = Object . entries ( obj ) ;
271+ for ( let i = 0 ; i < entries . length ; i += 1 ) {
272+ const entry = entries [ i ] ;
273+ const key = entry [ 0 ] ;
274+ const value = entry [ 1 ] ;
275+ if ( key === 'clickUrl' ) {
276+ clickUrl = value ;
277+ } else if ( key === 'targeting' ) {
278+ updateTargeting ( targeting , value ) ;
279+ } else {
280+ config [ key ] = value ;
281+ }
282+ }
283+ } catch ( ex ) {
284+ // do nothing
285+ }
286+ } ,
252287 setSafeFrameConfig : noopThis ,
253288 setTagForChildDirectedTreatment : noopThis ,
254289 setTargeting ( k , v ) {
@@ -267,6 +302,8 @@ export function GoogleTagServicesGpt(source) {
267302 return slot ;
268303 } ;
269304
305+ let initialLoadDisabled = false ;
306+
270307 const pubAdsService = {
271308 addEventListener,
272309 removeEventListener,
@@ -283,7 +320,9 @@ export function GoogleTagServicesGpt(source) {
283320 collapseEmptyDivs : noopFunc ,
284321 defineOutOfPagePassback ( ) { return new PassbackSlot ( ) ; } ,
285322 definePassback ( ) { return new PassbackSlot ( ) ; } ,
286- disableInitialLoad : noopFunc ,
323+ disableInitialLoad ( ) {
324+ initialLoadDisabled = true ;
325+ } ,
287326 display : noopFunc ,
288327 enableAsyncRendering : noopFunc ,
289328 enableLazyLoad : noopFunc ,
@@ -295,7 +334,7 @@ export function GoogleTagServicesGpt(source) {
295334 getTargeting : noopArray ,
296335 getTargetingKeys : noopArray ,
297336 getSlots : noopArray ,
298- isInitialLoadDisabled : trueFunc ,
337+ isInitialLoadDisabled : ( ) => initialLoadDisabled ,
299338 refresh : noopFunc ,
300339 set : noopThis ,
301340 setCategoryExclusion : noopThis ,
@@ -313,6 +352,8 @@ export function GoogleTagServicesGpt(source) {
313352 updateCorrelator : noopFunc ,
314353 } ;
315354
355+ const config = { } ;
356+
316357 const { googletag = { } } = window ;
317358 const { cmd = [ ] } = googletag ;
318359
@@ -346,10 +387,44 @@ export function GoogleTagServicesGpt(source) {
346387 displaySlot ( slotsById . get ( id ) ) ;
347388 } ;
348389 googletag . enableServices = noopFunc ;
390+ googletag . getConfig = function ( keys ) {
391+ const configKeys = Array . isArray ( keys ) ? keys : [ keys ] ;
392+ const googleTagServicesConfig = { } ;
393+ for ( let i = 0 ; i < configKeys . length ; i += 1 ) {
394+ const key = configKeys [ i ] ;
395+ if ( key === 'disableInitialLoad' ) {
396+ googleTagServicesConfig [ key ] = initialLoadDisabled ;
397+ } else if ( key === 'targeting' ) {
398+ googleTagServicesConfig [ key ] = gTargeting ;
399+ } else {
400+ googleTagServicesConfig [ key ] = config [ key ] ;
401+ }
402+ }
403+ return Object . freeze ( googleTagServicesConfig ) ;
404+ } ;
349405 googletag . getVersion = noopStr ;
350406 googletag . pubads = ( ) => pubAdsService ;
351407 googletag . pubadsReady = true ;
352408 googletag . setAdIframeTitle = noopFunc ;
409+ googletag . setConfig = function ( obj ) {
410+ try {
411+ const entries = Object . entries ( obj ) ;
412+ for ( let i = 0 ; i < entries . length ; i += 1 ) {
413+ const entry = entries [ i ] ;
414+ const key = entry [ 0 ] ;
415+ const value = entry [ 1 ] ;
416+ if ( key === 'disableInitialLoad' ) {
417+ initialLoadDisabled = ! ! value ;
418+ } else if ( key === 'targeting' ) {
419+ updateTargeting ( gTargeting , value ) ;
420+ } else {
421+ config [ key ] = value ;
422+ }
423+ }
424+ } catch ( ex ) {
425+ // do nothing
426+ }
427+ } ;
353428 googletag . sizeMapping = ( ) => new SizeMappingBuilder ( ) ;
354429
355430 window . googletag = googletag ;
0 commit comments