PageSourceSearch

https://bearingarms.com/prebid/prebid-wrapper.js?v=mqkk3HzZOkvNxU_moBeapfVQW7e-bG-Uo04xSsSDadI

js bearingarms.com collected 2026-10-02 02:23:29 UTC 10,859 bytes, 318 lines download raw bytes

1var pbjs = pbjs || {};
2pbjs.que = pbjs.que || [];
3pbjs.que.push(function () {
4    pbjs.setConfig({
5        targetingControls: {
6            addTargetingKeys: ['ADOMAIN']
7        },
8        sizeConfig: [
9            {
10                mediaQuery: '(min-width: 1025px)',
11                sizesSupported: desktopSizes,
12                labels: ['desktop']
13            },
14            {
15                mediaQuery: '(min-width: 768px) and (max-width: 1024px)',
16                sizesSupported: tabletSizes,
17                labels: ['tablet']
18            },
19            {
20                mediaQuery: '(min-width: 320px) and (max-width: 767px)',
21                sizesSupported: phoneSizes,
22                labels: ['phone']
23            }
24        ],
25        useBidCache: true,
26        userSync: {
27            iframeEnabled: true,
28            filterSettings: {
29                iframe: {
30                    bidders: '*', //['pubmatic','openx','teads']
31                    filter: 'include'
32                }
33            },
34            userIds: [
35                {
36                    name: 'criteo'
37                },
38                {
39                    // Adopts the existing _pubcid cookie, replacing GAM's deprecated SharedId deploy.
40                    name: 'sharedId',
41                    storage: { type: 'cookie', name: '_pubcid', expires: 365 }
42                },
43                {
44                    name: 'id5Id',
45                    params: {
46                        partner: 915,
47                        // Required so this module interoperates with the id5-api.js tag already on the page.
48                        externalModuleUrl: 'https://cdn.id5-sync.com/api/1.0/id5PrebidModule.js'
49                    },
50                    // refreshInSeconds must stay <= 7200: ID5 rotates its encryption key.
51                    storage: { type: 'html5', name: 'id5id', expires: 90, refreshInSeconds: 7200 }
52                },
53                {
54                    // Resolution is done by the lc2.js LiveConnect tag; build with LiveConnectMode=external.
55                    name: 'liveIntentId',
56                    params: {
57                        publisherId: '6150'
58                    },
59                    storage: { type: 'cookie', name: 'pbjs_li_nonid', expires: 1 }
60                }
61            ],
62            auctionDelay: 50,
63            syncDelay: 6000
64        },
65        priceGranularity: 'auto',
66        enableSendAllBids: true,
67        // Off by default in Prebid 8+, which blocks transmitTid for every bidder. Adagio needs it.
68        enableTIDs: true,
69        bidderSequence: 'random',
70        pageUrl: document.location.href,
71        realTimeData: {
72            dataProviders: [
73                {
74                    name: 'adagio',
75                    params: {
76                        organizationId: '1475',
77                        site: PREBID_ADAGIO
78                    }
79                }
80            ]
81        },
82        // bidViewabilityIO is the module in our build. It reads only `enabled` and emits
83        // bidViewable; firePixels/customMatchFunction belong to the GPT-based bidViewability
84        // module, which is not bundled.
85        bidViewabilityIO: {
86            enabled: true
87        }
88        //maxRequestsPerOrigin: 6
89    });
90});
91
92pbjs.bidderSettings = {
93    standard: {
94        storageAllowed: true
95    },
96    adagio: {
97        storageAllowed: true
98    },
99    pubmatic: {
100        storageAllowed: true,
101        bidCpmAdjustment: function (bidCpm) {
102            return parseInt(bidCpm);
103        }
104    },
105    rubicon: {
106        storageAllowed: true,
107        bidCpmAdjustment: function (bidCpm) {
108            return 0.88 * bidCpm;
109        }
110    },
111    openx: {
112        storageAllowed: true,
113        alwaysUseBid: true,
114        adserverTargeting: [
115            {
116                key: 'oxb',
117                val: function (bidResponse) {
118                    var bid;
119                    if (bidResponse.cpm < 1) {
120                        bid = ((Math.floor(bidResponse.cpm * 20) / 20) * 100).toFixed(0);
121                    } else if (bidResponse.cpm < 5) {
122                        bid = ((Math.floor(bidResponse.cpm * 10) / 10) * 100).toFixed(0);
123                    } else if (bidResponse.cpm < 20) {
124                        bid = ((Math.floor(bidResponse.cpm * 2) / 2) * 100).toFixed(0);
125                    } else {
126                        bid = '2000';
127                    }
128                    return bidResponse.width + 'x' + bidResponse.height + '_' + bid;
129                }
130            }
131        ]
132    }
133};
134
135var googletag = googletag || {};
136googletag.cmd = googletag.cmd || [];
137
138//apstag init config
139!(function (a9, a, p, s, t, A, g) {
140    if (a[a9]) return;
141    function q(c, r) {
142        a[a9]._Q.push([c, r]);
143    }
144    a[a9] = {
145        init: function () {
146            q('i', arguments);
147        },
148        fetchBids: function () {
149            q('f', arguments);
150        },
151        setDisplayBids: function () {},
152        targetingKeys: function () {
153            return [];
154        },
155        dpa: function () {
156            q('di', arguments);
157        },
158        rpa: function () {
159            q('ri', arguments);
160        },
161        upa: function () {
162            q('ui', arguments);
163        },
164        _Q: []
165    };
166})('apstag', window);
167apstag.init({
168    pubID: '3281',
169    adServer: 'googletag'
170});
171var parsedUrl = new URL(window.location.href);
172if (parsedUrl.searchParams.get('bcid') !== null) {
173    var tokenConfig = {
174        hashedRecords: [
175            {
176                type: 'email',
177                record: parsedUrl.searchParams.get('bcid')
178            }
179        ]
180    };
181    apstag.rpa(tokenConfig);
182}
183// Ad builder historically emits FAN.getPlacementId('uuid') as a string.
184// Latest fanBidAdapter expects a bare UUID — unwrap before Prebid sees it.
185function sanitizeAdUnits(adUnits) {
186    if (!adUnits || !adUnits.length) {
187        return adUnits;
188    }
189    var fanPlacement = /^FAN\.getPlacementId\(\s*['"]([^'"]+)['"]\s
189*\)$/;
190    for (var i = 0; i < adUnits.length; i++) {
191        var bids = adUnits[i].bids || [];
192        for (var j = 0; j < bids.length; j++) {
193            var bid = bids[j];
194            if (bid.bidder === 'freedomadnetwork' && bid.params && typeof bid.params.placementId === 'string') {
195                var match = bid.params.placementId.match(fanPlacement);
196                if (match) {
197                    bid.params.placementId = match[1];
198                }
199            }
200        }
201    }
202    return adUnits;
203}
204
205function fetchHeaderBids(apstagSlots, adUnits) {
206    var TIMEOUT = typeof PREBID_TIMEOUT !== 'undefined' ? PREBID_TIMEOUT : 2500;
207    var FAILSAFE = typeof FAILSAFE_TIMEOUT !== 'undefined' ? FAILSAFE_TIMEOUT : TIMEOUT + 1500;
208
209    //declare bidders
210    var bidders = ['a9', 'prebid'];
211
212    // create a requestManager to keep track of bidder state to determine when to send ad server
213    // request and what apstagSlots to request from the ad server
214    var requestManager = {
215        adserverRequestSent: false,
216        apstagSlots: apstagSlots,
217        adUnits: sanitizeAdUnits(adUnits)
218    };
219
220    //loop through bidder array and add the bidders to the request manager:
221    bidders.forEach(function (bidder) {
222        requestManager[bidder] = false;
223    });
224
225    // return true if all bidders have returned
226    function allBiddersBack() {
227        var allBiddersBack =
228            // if length is equal to bidders, all bidders are back
229            bidders
230                // get the booleans from the object
231                .map(function (bidder) {
232                    return requestManager[bidder];
233                })
234                // get rid of false values - indicates that the bidder has responded
235                .filter(Boolean).length === bidders.length;
236        return allBiddersBack;
237    }
238
239    // handler for header bidder responses
240    function headerBidderBack(bidder) {
241        // return early if request to adserver is already sent
242        if (requestManager.adserverRequestSent === true) {
243            return;
244        }
245        // set the bidder targeting and flip bidder back flag
246        if (bidder === 'a9') {
247            requestManager.a9 = true;
248        } else if (bidder === 'prebid') {
249            requestManager.prebid = true;
250        }
251
252        // if all bidders are back, send the request to the ad server
253        if (allBiddersBack()) {
254            console.log('%call bids are back', 'color: blue');
255            sendAdserverRequest();
256        }
257    }
258
259    // actually get ads from DFP
260    function sendAdserverRequest() {
261        // return early if request already sent
262        if (requestManager.adserverRequestSent === true) {
263            return;
264        }
265
266        // flip the boolean that keeps track of whether the adserver request was sent
267        requestManager.adserverRequestSent = true;
268
269        // make ad request to DFP
270        googletag.cmd.push(function () {
271            apstag.setDisplayBids();
272            pbjs.setTargetingForGPTAsync();
273            console.log('sending bids to gampad');
274            googletag.pubads().refresh();
275        });
276    }
277
278    function requestBids() {
279        console.log('request PREBID bids');
280        // request bids from prebid
281        pbjs.que.push(function () {
282            pbjs.addAdUnits(requestManager.adUnits);
283            pbjs.requestBids({
284                timeout: TIMEOUT,
285                //labels: pjLabels,
286                bidsBackHandler: function (bidResponses) {
287                    console.log('bids came back from PREBID');
288                    headerBidderBack('prebid');
289                }
290            });
291        });
292        console.log('request APS bids');
293        // fetch bids from APS
294        if (requestManager.apstagSlots.length > 0) {
295            apstag.fetchBids(
296                {
297                    slots: requestManager.apstagSlots
298                },
299                function (bids) {
300                    console.log('%cbids came back from APS', 'color: green');
301                    headerBidderBack('a9');
302                }
303            );
304        } else {
305            // No APS slots — mark a9 complete so we don't wait for the full timeout
306            headerBidderBack('a9');
307        }
308    }
309
310    requestBids();
311    // Backstop only. This timer starts before prebid.js (loaded async) has finished, so it must be
312    // longer than TIMEOUT or it cuts the auction short and GAM gets empty hb_* targeting.
313    window.setTimeout(function () {
314        sendAdserverRequest();
315    }, FAILSAFE);
316}
317
318fetchHeaderBids(apstagSlots, adUnits);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.