JSFiddle - React, Tailwind, and code Playground
by Abhinav Sinha
HTML
<html>
<title>Identity Hub with Prebid</title>
<head>
<link rel="icon" type="image/png" href="/favicon.png">
<!-- Identity Hub Script begins here -->
<script type="text/javascript">
var PWT={}; //Initialize Namespace
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
var callBackExecuted = false;
PWT.jsLoaded = function(){ //PubMatic pwt.js on load callback is used to load GPT and Prebid
loadPrebidAndGPT();
};
var loadPrebidAndGPT = function() {
// Check the gptRan flag
if (!callBackExecuted) {
callBackExecuted = true;
var gads = document.createElement('script');
var useSSL = 'https:' == document.location.protocol;
gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js';
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(gads, node);
var pbjsEl = document.createElement("script");
pbjsEl.type = "text/javascript";
pbjsEl.async = true;
pbjsEl.src = "https://cdn.jsdelivr.net/gh/abhinavsinha001/cdn/prebid/prebid2.44.7-2.js"; //Your Prebid JS URL
var pbjsTargetEl = document.getElementsByTagName("head")[0];
pbjsTargetEl.insertBefore(pbjsEl, pbjsTargetEl.firstChild);
}
};
// Failsafe to call prebid & gpt
setTimeout(loadPrebidAndGPT, 100);
</script>
<script type="text/javascript">
(function() {
var purl = window.location.href;
var url = '//ads.pubmatic.com/AdServer/js/pwt/5890/1804/';
var profileVersionId = '';
if(purl.indexOf('pwtv=')>0){
var regexp = /pwtv=(.*?)(&|$)/g;
var matches = regexp.exec(purl);
if(matches.length >= 2 && matches[1].length > 0){
profileVersionId = '/'+matches[1];
...