-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Mozilla's Criteo shim script (#33)
Some websites display a "Please disable your ad blocker" wall, or otherwise break when the criteo.net/js/ld/publishertag.js script is blocked. Let's instead redirect that request to Mozilla's shim script[1]. 1 - https://searchfox.org/mozilla-central/source/browser/extensions/webcompat/shims/criteo.js
- Loading branch information
Showing
2 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
"use strict"; | ||
|
||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
// Based on https://searchfox.org/mozilla-central/source/browser/extensions/webcompat/shims/criteo.js | ||
|
||
/* eslint indent: ["error", 2], quotes: ["error", "double"], | ||
comma-dangle: ["error", "only-multiline"], space-before-function-paren: ["error", "never"] */ | ||
|
||
/** | ||
* Bug 1713720 - Shim Criteo | ||
* | ||
* Sites relying on window.Criteo to be loaded can experience | ||
* breakage if it is blocked. Stubbing out the API in a shim can | ||
* mitigate this breakage. | ||
*/ | ||
|
||
if (!(window.Criteo && window.Criteo.CallRTA)) { | ||
window.Criteo = { | ||
CallRTA() {}, | ||
ComputeStandaloneDFPTargeting() {}, | ||
DisplayAcceptableAdIfAdblocked() {}, | ||
DisplayAd() {}, | ||
GetBids() {}, | ||
GetBidsForAdUnit() {}, | ||
Passback: { | ||
RequestBids() {}, | ||
RenderAd() {}, | ||
}, | ||
PubTag: { | ||
Adapters: { | ||
AMP() {}, | ||
Prebid() {}, | ||
}, | ||
Context: { | ||
GetIdfs() {}, | ||
SetIdfs() {}, | ||
}, | ||
DirectBidding: { | ||
DirectBiddingEvent() {}, | ||
DirectBiddingSlot() {}, | ||
DirectBiddingUrlBuilder() {}, | ||
Size() {}, | ||
}, | ||
RTA: { | ||
DefaultCrtgContentName: "crtg_content", | ||
DefaultCrtgRtaCookieName: "crtg_rta", | ||
}, | ||
}, | ||
RenderAd() {}, | ||
RequestBids() {}, | ||
RequestBidsOnGoogleTagSlots() {}, | ||
SetCCPAExplicitOptOut() {}, | ||
SetCeh() {}, | ||
SetDFPKeyValueTargeting() {}, | ||
SetLineItemRanges() {}, | ||
SetPublisherExt() {}, | ||
SetSlotsExt() {}, | ||
SetTargeting() {}, | ||
SetUserExt() {}, | ||
events: { | ||
push() {}, | ||
}, | ||
passbackEvents: [], | ||
usePrebidEvents: true, | ||
}; | ||
} |