forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatamageRtdProvider_example.html
More file actions
143 lines (120 loc) · 5.5 KB
/
datamageRtdProvider_example.html
File metadata and controls
143 lines (120 loc) · 5.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>OpsMage Prebid Test Page</title>
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js" crossorigin="anonymous"></script>
<script>
window.googletag = window.googletag || { cmd: [] };
window.gptSlot = null;
googletag.cmd.push(function () {
googletag.pubads().disableInitialLoad();
// Save slot reference so we can refresh JUST this slot
window.gptSlot = googletag.defineSlot(
'/50536250/designcon',
[[300, 250]],
'div-gpt-ad-1771335974713-0'
).addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
// Display once (no request yet because disableInitialLoad)
googletag.display('div-gpt-ad-1771335974713-0');
});
// Helper function to verify targeting in the console
function dumpGptTargeting(label) {
googletag.cmd.push(function () {
const pubads = googletag.pubads();
const keys = pubads.getTargetingKeys();
const pubadsMap = {};
keys.forEach(k => { pubadsMap[k] = pubads.getTargeting(k); });
console.log(label, 'PUBADS targeting:', pubadsMap);
if (window.gptSlot && typeof window.gptSlot.getTargetingMap === 'function') {
console.log(label, 'SLOT targeting:', window.gptSlot.getTargetingMap());
}
});
}
</script>
<script async src="build/dev/prebid.js"></script>
<script>
var pbjs = window.pbjs = window.pbjs || {};
pbjs.que = pbjs.que || [];
var PREBID_TIMEOUT = 1500;
var adUnits = [{
code: 'div-gpt-ad-1771335974713-0',
mediaTypes: { banner: { sizes: [[300, 250]] } },
bids: [{
bidder: 'appnexus',
params: { placementId: 1234567 }
}]
}];
pbjs.que.push(function () {
pbjs.setConfig({
debug: true,
consentManagement: {
allowAuctionWithoutConsent: true,
gdpr: {
cmpApi: 'static',
timeout: 0,
consentData: {
getTCData: {
tcString: 'CPAa+2APAa+2AAOACBENC1CoAP_AAH_AAAAAAwwxgAAAAA',
gdprApplies: true,
purpose: { consents: { 1: true, 2: true, 3: true, 4: true, 5: true } },
vendor: { consents: { 1: true }, legitimateInterests: { 1: true } }
}
}
},
usp: { cmpApi: 'static', timeout: 0, consentData: { getUSPData: { uspString: '1---' } } }
},
allowActivities: {
accessDevice: { rules: [{ action: 'allow' }] },
enrichUfpd: { rules: [{ action: 'allow' }] },
enrichEids: { rules: [{ action: 'allow' }] },
transmitTid: { rules: [{ action: 'allow' }] }
},
realTimeData: {
auctionDelay: 1000, // Prebid will wait up to 1000ms for Datamage to fetch data
dataProviders: [{
name: "datamage",
waitForIt: true, // <--- CRITICAL FIX: Forces Prebid to wait for this module
params: {
api_key: '8328309832',
selector: 'article',
fetch_timeout_ms: 2500
}
}]
}
});
pbjs.addAdUnits(adUnits);
pbjs.requestBids({
bidsBackHandler: function () {
// Push standard header bidding keys (like hb_pb) to GPT
pbjs.setTargetingForGPTAsync();
// Dump targeting to verify Datamage was successfully pushed via setConfig
dumpGptTargeting('[before refresh]');
// Refresh only our specific slot
googletag.cmd.push(function () {
if (window.gptSlot) {
googletag.pubads().refresh([window.gptSlot]);
} else {
// Fallback
googletag.pubads().refresh();
}
});
},
timeout: PREBID_TIMEOUT
});
});
</script>
</head>
<body>
<h2>OpsMage Prebid Test Page</h2>
<div id="div-gpt-ad-1771335974713-0" style="width:300px; height:250px;"></div>
<article>The tech world is currently buzzing over the highly anticipated market debut of fakeDSP, a trailblazing
startup poised to redefine the landscape of digital signal processing. Leveraging proprietary neuromorphic
algorithms and quantum-ready architecture, fakeDSP promises to accelerate real-time data synthesis by speeds
previously thought impossible. With early analysts calling it a definitive disruptor in both the
telecommunications and audio-engineering sectors, the company’s entrance signifies a major leap forward in how
complex signals are analyzed and reconstructed in the AI era.</article>
</body>
</html>