forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'prebid:master' into master
- Loading branch information
Showing
48 changed files
with
2,699 additions
and
595 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script> | ||
<script> | ||
window.googletag = window.googletag || { cmd: [] }; | ||
googletag.cmd.push(function () { | ||
googletag.defineSlot('/46380388/herbeauty_prebid', [[320, 100], [950, 90], [1024, 768], [120, 600], [300, 75], [970, 66], [300, 50], [300, 31], [320, 480], [750, 200], 'fluid', [250, 250], [250, 360], [120, 90], [1, 1], [292, 30], [300, 100], [768, 1024], [88, 31], [200, 200], [300, 600], [300, 1050], [960, 90], [125, 125], [180, 150], [970, 250], [168, 28], [980, 120], [120, 20], [120, 240], [480, 320], [468, 60], [120, 30], [120, 60], [750, 300], [930, 180], [728, 90], [168, 42], [980, 90], [320, 50], [750, 100], [200, 446], [336, 280], [300, 250], [580, 400], [970, 90], [160, 600]], 'div-gpt-ad-1660208650016-0').addService(googletag.pubads()); | ||
googletag.pubads().enableSingleRequest(); | ||
googletag.enableServices(); | ||
}); | ||
</script> | ||
<link rel="icon" type="image/png" href="/favicon.png"> | ||
<script src="../../build/dev/prebid.js" async></script> | ||
<script> | ||
var sizes = [ | ||
[300, 250] | ||
]; | ||
var PREBID_TIMEOUT = 1000; | ||
var FAILSAFE_TIMEOUT = 3000; | ||
var adUnits = [{ | ||
code: '/46380388/herbeauty_prebid', | ||
mediaTypes: { | ||
banner: { | ||
sizes: [[320, 100], [950, 90], [1024, 768], [120, 600], [300, 75], [970, 66], [300, 50], [300, 31], [320, 480], [750, 200], [250, 250], [250, 360], [120, 90], [1, 1], [292, 30], [300, 100], [768, 1024], [88, 31], [200, 200], [300, 600], [300, 1050], [960, 90], [125, 125], [180, 150], [970, 250], [168, 28], [980, 120], [120, 20], [120, 240], [480, 320], [468, 60], [120, 30], [120, 60], [750, 300], [930, 180], [728, 90], [168, 42], [980, 90], [320, 50], [750, 100], [200, 446], [336, 280], [300, 250], [580, 400], [970, 90], [160, 600]] | ||
} | ||
}, | ||
bids: [{ | ||
bidder: 'mgid', | ||
params: { | ||
accountId: '219' | ||
} | ||
}] | ||
}]; | ||
// ======== DO NOT EDIT BELOW THIS LINE =========== // | ||
var googletag = googletag || {}; | ||
googletag.cmd = googletag.cmd || []; | ||
googletag.cmd.push(function () { | ||
googletag.pubads().disableInitialLoad(); | ||
}); | ||
var pbjs = pbjs || {}; | ||
pbjs.que = pbjs.que || []; | ||
pbjs.que.push(function () { | ||
pbjs.setConfig({ priceGranularity: 'high' }) | ||
pbjs.setConfig({ | ||
debug: true, | ||
realTimeData: { | ||
auctionDelay: 1000, | ||
dataProviders: [{ | ||
name: 'mgid', | ||
waitForIt: true, | ||
params: { | ||
clientSiteId: 1 | ||
} | ||
}] | ||
}, | ||
/*consentManagement: { | ||
gdpr: { | ||
cmpApi: 'iab', | ||
timeout: 8000, | ||
defaultGdprScope: true | ||
} | ||
}*/ | ||
// static data for consent management is only for test purpose - with this data we didn't get ads at the auction | ||
/*consentManagement: { | ||
usp: { | ||
cmpApi: 'static', | ||
consentData: { | ||
getUSPData: { | ||
uspString: '1YNY', | ||
} | ||
} | ||
}, | ||
gdpr: { | ||
cmpApi: 'static', | ||
consentData: { | ||
getTCData: { | ||
tcString: 'COwK6gaOwK6gaFmAAAENAPCAAAAAAAAAAAAAAAAAAAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw', | ||
gdprApplies: true, | ||
purpose: { | ||
consents: { | ||
1: true, | ||
2: true, | ||
}, | ||
}, | ||
vendor: { | ||
consents: { | ||
358: true, | ||
}, | ||
} | ||
} | ||
} | ||
} | ||
}*/ | ||
}); | ||
pbjs.addAdUnits(adUnits); | ||
pbjs.requestBids({ | ||
bidsBackHandler: initAdserver, | ||
timeout: PREBID_TIMEOUT, | ||
ortb2: { | ||
site: { | ||
content: { | ||
language: 'en', | ||
} | ||
} | ||
} | ||
}); | ||
}); | ||
|
||
function initAdserver() { | ||
if (pbjs.initAdserverSet) return; | ||
pbjs.initAdserverSet = true; | ||
googletag.cmd.push(function () { | ||
pbjs.setTargetingForGPTAsync && pbjs.setTargetingForGPTAsync(); | ||
googletag.pubads().refresh(); | ||
}); | ||
} | ||
|
||
// in case PBJS doesn't load | ||
setTimeout(function () { | ||
initAdserver(); | ||
}, FAILSAFE_TIMEOUT); | ||
|
||
</script> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<title>JS Bin</title> | ||
</head> | ||
<body> | ||
|
||
<h2>Basic Prebid.js Example</h2> | ||
<h5>Div-1</h5> | ||
|
||
<div id='div-gpt-ad-1660208650016-0' style='min-width: 88px; min-height: 20px;'> | ||
<script> | ||
googletag.cmd.push(function () { | ||
googletag.display('div-gpt-ad-1660208650016-0'); | ||
}); | ||
</script> | ||
</div> | ||
|
||
</body> | ||
</html> |
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,59 @@ | ||
import {isEmptyStr, isStr, logError, isFn, logWarn} from '../src/utils.js'; | ||
import {submodule} from '../src/hook.js'; | ||
import { loadExternalScript } from '../src/adloader.js'; | ||
|
||
export const _config = { | ||
MODULE: 'aaxBlockmeter', | ||
ADSERVER_TARGETING_KEY: 'atk', | ||
BLOCKMETER_URL: 'c.aaxads.com/aax.js', | ||
VERSION: '1.2' | ||
}; | ||
|
||
window.aax = window.aax || {}; | ||
|
||
function loadBlockmeter(_rtdConfig) { | ||
if (!(_rtdConfig.params && _rtdConfig.params.pub) || !isStr(_rtdConfig.params && _rtdConfig.params.pub) || isEmptyStr(_rtdConfig.params && _rtdConfig.params.pub)) { | ||
logError(`${_config.MODULE}: params.pub should be a string`); | ||
return false; | ||
} | ||
|
||
const params = []; | ||
params.push(`pub=${_rtdConfig.params.pub}`); | ||
params.push(`dn=${window.location.hostname}`); | ||
|
||
let url = _rtdConfig.params.url; | ||
if (!url || isEmptyStr(url)) { | ||
logWarn(`${_config.MODULE}: params.url is missing, using default url.`); | ||
url = `${_config.BLOCKMETER_URL}?ver=${_config.VERSION}`; | ||
} | ||
|
||
const scriptUrl = `https://${url}&${params.join('&')}`; | ||
loadExternalScript(scriptUrl, _config.MODULE); | ||
return true; | ||
} | ||
|
||
function markAdBlockInventory(codes, _rtdConfig, _userConsent) { | ||
return codes.reduce((targets, code) => { | ||
targets[code] = targets[code] || {}; | ||
const getAaxTargets = () => isFn(window.aax.getTargetingData) | ||
? window.aax.getTargetingData(code, _rtdConfig, _userConsent) | ||
: {}; | ||
targets[code] = { | ||
[_config.ADSERVER_TARGETING_KEY]: code, | ||
...getAaxTargets() | ||
}; | ||
return targets; | ||
}, {}); | ||
} | ||
|
||
export const aaxBlockmeterRtdModule = { | ||
name: _config.MODULE, | ||
init: loadBlockmeter, | ||
getTargetingData: markAdBlockInventory, | ||
}; | ||
|
||
function registerSubModule() { | ||
submodule('realTimeData', aaxBlockmeterRtdModule); | ||
} | ||
|
||
registerSubModule(); |
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,48 @@ | ||
## Overview | ||
|
||
Module Name: AAX Blockmeter Realtime Data Module | ||
Module Type: Rtd Provider | ||
Maintainer: product@aax.media | ||
|
||
## Description | ||
|
||
The module enables publishers to measure traffic coming from visitors using adblockers. | ||
|
||
AAX can also help publishers monetize this traffic by allowing them to serve [acceptable ads](https://acceptableads.com/about/) to these adblock visitors and recover their lost revenue. [Reach out to us](https://www.aax.media/try-blockmeter/) to know more. | ||
|
||
## Integration | ||
|
||
Build the AAX Blockmeter Realtime Data Module into the Prebid.js package with: | ||
|
||
``` | ||
gulp build --modules=aaxBlockmeterRtdProvider,rtdModule | ||
``` | ||
|
||
## Configuration | ||
|
||
This module is configured as part of the `realTimeData.dataProviders` object. | ||
|
||
| Name | Scope | Description | Example | Type | | ||
|:----------:|:--------:|:-----------------------------|:---------------:|:------:| | ||
| `name` | required | Real time data module name | `'aaxBlockmeter'` | `string` | | ||
| `params` | required | | | `Object` | | ||
| `params.pub` | required | AAX to share pub ID, [Reach out to us](https://www.aax.media/try-blockmeter/) to know more! | `'AAX00000'` | `string` | | ||
| `params.url` | optional | AAX Blockmeter Script Url. Defaults to `'c.aaxads.com/aax.js?ver=1.2'` | `'c.aaxads.com/aax.js?ver=1.2'` | `string` | | ||
|
||
### Example | ||
|
||
```javascript | ||
pbjs.setConfig({ | ||
"realTimeData": { | ||
"dataProviders": [ | ||
{ | ||
"name": "aaxBlockmeter", | ||
"params": { | ||
"pub": "AAX00000", | ||
"url": "c.aaxads.com/aax.js?ver=1.2", | ||
} | ||
} | ||
] | ||
} | ||
}) | ||
``` |
Oops, something went wrong.