@mixpeek/prebid 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +153 -0
- package/ENDPOINTS.md +308 -0
- package/LICENSE +68 -0
- package/QUICKSTART.md +234 -0
- package/README.md +439 -0
- package/TESTING.md +341 -0
- package/dist/mixpeekContextAdapter.js +3 -0
- package/dist/mixpeekContextAdapter.js.LICENSE.txt +1 -0
- package/dist/mixpeekContextAdapter.js.map +1 -0
- package/docs/MIGRATION_V2.md +519 -0
- package/docs/api-reference.md +455 -0
- package/docs/health-check.md +348 -0
- package/docs/integration-guide.md +577 -0
- package/examples/publisher-demo/README.md +65 -0
- package/examples/publisher-demo/index.html +331 -0
- package/examples/publisher-demo/package.json +11 -0
- package/package.json +82 -0
- package/src/api/mixpeekClient.js +303 -0
- package/src/cache/cacheManager.js +245 -0
- package/src/config/constants.js +125 -0
- package/src/extractors/imageExtractor.js +142 -0
- package/src/extractors/pageExtractor.js +196 -0
- package/src/extractors/videoExtractor.js +228 -0
- package/src/modules/mixpeekContextAdapter.js +833 -0
- package/src/modules/mixpeekRtdProvider.js +305 -0
- package/src/prebid/prebidIntegration.js +117 -0
- package/src/utils/helpers.js +261 -0
- package/src/utils/iabMapping.js +367 -0
- package/src/utils/logger.js +64 -0
- package/src/utils/previousAdTracker.js +95 -0
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<meta name="description" content="Demonstration of Mixpeek Context Adapter for Prebid.js in action">
|
|
7
|
+
<meta property="og:title" content="Mixpeek Prebid Demo - Mobile Technology">
|
|
8
|
+
<meta property="og:description" content="Explore the latest in mobile phone technology and AI-powered features">
|
|
9
|
+
<meta property="og:image" content="https://via.placeholder.com/1200x630?text=Mobile+Tech">
|
|
10
|
+
<title>Mixpeek Prebid Demo - Mobile Technology Article</title>
|
|
11
|
+
|
|
12
|
+
<style>
|
|
13
|
+
body {
|
|
14
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
15
|
+
line-height: 1.6;
|
|
16
|
+
max-width: 1200px;
|
|
17
|
+
margin: 0 auto;
|
|
18
|
+
padding: 20px;
|
|
19
|
+
background: #f5f5f5;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
header {
|
|
23
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
24
|
+
color: white;
|
|
25
|
+
padding: 40px;
|
|
26
|
+
border-radius: 10px;
|
|
27
|
+
margin-bottom: 30px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
h1 {
|
|
31
|
+
margin: 0 0 10px 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.meta {
|
|
35
|
+
opacity: 0.9;
|
|
36
|
+
font-size: 0.9em;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.container {
|
|
40
|
+
display: grid;
|
|
41
|
+
grid-template-columns: 2fr 1fr;
|
|
42
|
+
gap: 20px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
article {
|
|
46
|
+
background: white;
|
|
47
|
+
padding: 30px;
|
|
48
|
+
border-radius: 10px;
|
|
49
|
+
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.featured-image {
|
|
53
|
+
width: 100%;
|
|
54
|
+
height: 400px;
|
|
55
|
+
object-fit: cover;
|
|
56
|
+
border-radius: 10px;
|
|
57
|
+
margin-bottom: 20px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.sidebar {
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
gap: 20px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.ad-unit {
|
|
67
|
+
background: white;
|
|
68
|
+
padding: 20px;
|
|
69
|
+
border-radius: 10px;
|
|
70
|
+
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
71
|
+
text-align: center;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.ad-label {
|
|
75
|
+
font-size: 0.7em;
|
|
76
|
+
color: #999;
|
|
77
|
+
text-transform: uppercase;
|
|
78
|
+
margin-bottom: 10px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.debug-panel {
|
|
82
|
+
background: #1e1e1e;
|
|
83
|
+
color: #d4d4d4;
|
|
84
|
+
padding: 20px;
|
|
85
|
+
border-radius: 10px;
|
|
86
|
+
margin-top: 20px;
|
|
87
|
+
font-family: 'Courier New', monospace;
|
|
88
|
+
font-size: 0.85em;
|
|
89
|
+
overflow-x: auto;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.debug-panel h3 {
|
|
93
|
+
color: #4ec9b0;
|
|
94
|
+
margin-top: 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.debug-panel pre {
|
|
98
|
+
margin: 0;
|
|
99
|
+
white-space: pre-wrap;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.status {
|
|
103
|
+
display: inline-block;
|
|
104
|
+
padding: 2px 8px;
|
|
105
|
+
border-radius: 3px;
|
|
106
|
+
font-size: 0.8em;
|
|
107
|
+
font-weight: bold;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.status.success {
|
|
111
|
+
background: #4caf50;
|
|
112
|
+
color: white;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.status.loading {
|
|
116
|
+
background: #ff9800;
|
|
117
|
+
color: white;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@media (max-width: 768px) {
|
|
121
|
+
.container {
|
|
122
|
+
grid-template-columns: 1fr;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
</style>
|
|
126
|
+
</head>
|
|
127
|
+
<body>
|
|
128
|
+
<header>
|
|
129
|
+
<h1>🧠 Mixpeek Context Adapter Demo</h1>
|
|
130
|
+
<p class="meta">Real-time AI-powered contextual advertising with Prebid.js</p>
|
|
131
|
+
</header>
|
|
132
|
+
|
|
133
|
+
<div class="container">
|
|
134
|
+
<article>
|
|
135
|
+
<img class="featured-image" src="https://via.placeholder.com/800x400?text=Latest+Mobile+Phones" alt="Mobile Phones">
|
|
136
|
+
|
|
137
|
+
<h2>The Evolution of Mobile Phones: AI-Powered Features Revolutionize Smartphones</h2>
|
|
138
|
+
|
|
139
|
+
<p class="meta">Published on <time datetime="2025-10-08">October 8, 2025</time> by Tech Editor</p>
|
|
140
|
+
|
|
141
|
+
<p>
|
|
142
|
+
The smartphone industry continues to evolve at a breakneck pace, with artificial intelligence
|
|
143
|
+
becoming the cornerstone of modern mobile phone technology. Today's devices are more than just
|
|
144
|
+
communication tools—they're powerful AI assistants that understand context, predict user needs,
|
|
145
|
+
and adapt to individual preferences.
|
|
146
|
+
</p>
|
|
147
|
+
|
|
148
|
+
<h3>AI-Driven Camera Technology</h3>
|
|
149
|
+
<p>
|
|
150
|
+
Modern mobile phones utilize advanced machine learning algorithms to capture stunning photographs.
|
|
151
|
+
From scene recognition to real-time image enhancement, AI has transformed smartphone photography
|
|
152
|
+
into a professional-grade experience. Night mode, portrait effects, and computational photography
|
|
153
|
+
are now standard features across most flagship devices.
|
|
154
|
+
</p>
|
|
155
|
+
|
|
156
|
+
<h3>Voice Assistants and Natural Language Processing</h3>
|
|
157
|
+
<p>
|
|
158
|
+
Voice assistants have become increasingly sophisticated, understanding natural language with
|
|
159
|
+
unprecedented accuracy. Whether you're setting reminders, composing messages, or searching for
|
|
160
|
+
information, AI-powered voice assistants make interactions seamless and intuitive.
|
|
161
|
+
</p>
|
|
162
|
+
|
|
163
|
+
<h3>Battery Optimization and Performance</h3>
|
|
164
|
+
<p>
|
|
165
|
+
Machine learning algorithms now monitor app usage patterns and system performance to optimize
|
|
166
|
+
battery life. By learning your habits, smartphones can intelligently allocate resources and
|
|
167
|
+
extend battery life by up to 30%.
|
|
168
|
+
</p>
|
|
169
|
+
|
|
170
|
+
<h3>The Future: On-Device AI Processing</h3>
|
|
171
|
+
<p>
|
|
172
|
+
The next frontier in mobile technology is on-device AI processing. With dedicated neural processing
|
|
173
|
+
units (NPUs), smartphones can perform complex AI tasks without cloud connectivity, ensuring faster
|
|
174
|
+
responses and enhanced privacy protection.
|
|
175
|
+
</p>
|
|
176
|
+
</article>
|
|
177
|
+
|
|
178
|
+
<aside class="sidebar">
|
|
179
|
+
<div class="ad-unit" id="div-banner-1">
|
|
180
|
+
<div class="ad-label">Advertisement</div>
|
|
181
|
+
<div id="banner-ad-content">
|
|
182
|
+
<!-- Prebid ad will load here -->
|
|
183
|
+
<div style="width: 300px; height: 250px; display: flex; align-items: center; justify-content: center; background: #f0f0f0; border: 2px dashed #ccc;">
|
|
184
|
+
Loading ad...
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
<div class="ad-unit" id="div-banner-2">
|
|
190
|
+
<div class="ad-label">Advertisement</div>
|
|
191
|
+
<div id="banner-ad-content-2">
|
|
192
|
+
<div style="width: 300px; height: 250px; display: flex; align-items: center; justify-content: center; background: #f0f0f0; border: 2px dashed #ccc;">
|
|
193
|
+
Loading ad...
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
196
|
+
</div>
|
|
197
|
+
</aside>
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
<div class="debug-panel">
|
|
201
|
+
<h3>🔍 Mixpeek Context Debug Panel</h3>
|
|
202
|
+
<div>
|
|
203
|
+
Status: <span class="status loading" id="status">Initializing...</span>
|
|
204
|
+
</div>
|
|
205
|
+
<br>
|
|
206
|
+
<pre id="debug-output">Waiting for context data...</pre>
|
|
207
|
+
</div>
|
|
208
|
+
|
|
209
|
+
<!-- Prebid.js -->
|
|
210
|
+
<script async src="https://cdn.jsdelivr.net/npm/prebid.js@latest/dist/prebid.js"></script>
|
|
211
|
+
|
|
212
|
+
<!-- Mixpeek Context Adapter -->
|
|
213
|
+
<script src="../../dist/mixpeekContextAdapter.js"></script>
|
|
214
|
+
|
|
215
|
+
<script>
|
|
216
|
+
// Initialize Prebid
|
|
217
|
+
var pbjs = pbjs || {};
|
|
218
|
+
pbjs.que = pbjs.que || [];
|
|
219
|
+
|
|
220
|
+
// Ad units configuration
|
|
221
|
+
var adUnits = [
|
|
222
|
+
{
|
|
223
|
+
code: 'div-banner-1',
|
|
224
|
+
mediaTypes: {
|
|
225
|
+
banner: {
|
|
226
|
+
sizes: [[300, 250], [300, 600]]
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
bids: [
|
|
230
|
+
{
|
|
231
|
+
bidder: 'rubicon',
|
|
232
|
+
params: {
|
|
233
|
+
accountId: '14062',
|
|
234
|
+
siteId: '70608',
|
|
235
|
+
zoneId: '335918'
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
code: 'div-banner-2',
|
|
242
|
+
mediaTypes: {
|
|
243
|
+
banner: {
|
|
244
|
+
sizes: [[300, 250]]
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
bids: [
|
|
248
|
+
{
|
|
249
|
+
bidder: 'appnexus',
|
|
250
|
+
params: {
|
|
251
|
+
placementId: '13144370'
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
];
|
|
257
|
+
|
|
258
|
+
// Configure Prebid with Mixpeek
|
|
259
|
+
pbjs.que.push(function() {
|
|
260
|
+
pbjs.setConfig({
|
|
261
|
+
// Mixpeek Context Adapter Configuration
|
|
262
|
+
mixpeek: {
|
|
263
|
+
apiKey: 'YOUR_MIXPEEK_API_KEY', // Replace with your API key
|
|
264
|
+
collectionId: 'YOUR_COLLECTION_ID', // Replace with your collection ID
|
|
265
|
+
namespace: 'demo', // Optional
|
|
266
|
+
mode: 'page', // 'page', 'video', or 'auto'
|
|
267
|
+
featureExtractors: ['taxonomy', 'brand-safety', 'keywords'],
|
|
268
|
+
timeout: 250,
|
|
269
|
+
cacheTTL: 300,
|
|
270
|
+
debug: true
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
// Other Prebid config
|
|
274
|
+
bidderTimeout: 3000,
|
|
275
|
+
enableSendAllBids: true
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
// Listen for Mixpeek events
|
|
279
|
+
pbjs.onEvent('mixpeekContextReady', function(context) {
|
|
280
|
+
console.log('Mixpeek context ready:', context);
|
|
281
|
+
updateDebugPanel('success', context);
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
pbjs.onEvent('mixpeekContextError', function(error) {
|
|
285
|
+
console.error('Mixpeek context error:', error);
|
|
286
|
+
updateDebugPanel('error', error);
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
// Add ad units
|
|
290
|
+
pbjs.addAdUnits(adUnits);
|
|
291
|
+
|
|
292
|
+
// Request bids
|
|
293
|
+
pbjs.requestBids({
|
|
294
|
+
bidsBackHandler: function(bids) {
|
|
295
|
+
console.log('Bids received:', bids);
|
|
296
|
+
|
|
297
|
+
// Render ads
|
|
298
|
+
Object.keys(bids).forEach(function(adUnitCode) {
|
|
299
|
+
pbjs.renderAd(document, bids[adUnitCode].adId);
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
// Debug panel updater
|
|
306
|
+
function updateDebugPanel(status, data) {
|
|
307
|
+
const statusEl = document.getElementById('status');
|
|
308
|
+
const outputEl = document.getElementById('debug-output');
|
|
309
|
+
|
|
310
|
+
if (status === 'success') {
|
|
311
|
+
statusEl.textContent = 'Context Loaded';
|
|
312
|
+
statusEl.className = 'status success';
|
|
313
|
+
|
|
314
|
+
outputEl.textContent = JSON.stringify({
|
|
315
|
+
taxonomy: data.taxonomy,
|
|
316
|
+
brandSafety: data.brandSafety,
|
|
317
|
+
keywords: data.keywords,
|
|
318
|
+
sentiment: data.sentiment,
|
|
319
|
+
mode: data.mode,
|
|
320
|
+
documentId: data.documentId
|
|
321
|
+
}, null, 2);
|
|
322
|
+
} else {
|
|
323
|
+
statusEl.textContent = 'Error';
|
|
324
|
+
statusEl.className = 'status error';
|
|
325
|
+
outputEl.textContent = JSON.stringify(data, null, 2);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
</script>
|
|
329
|
+
</body>
|
|
330
|
+
</html>
|
|
331
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mixpeek/prebid",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Mixpeek for Prebid.js - Enrich bid requests with real-time multimodal AI contextual data",
|
|
5
|
+
"main": "dist/mixpeekContextAdapter.js",
|
|
6
|
+
"module": "src/modules/mixpeekContextAdapter.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "webpack --mode production",
|
|
9
|
+
"build:dev": "webpack --mode development",
|
|
10
|
+
"test": "jest",
|
|
11
|
+
"test:unit": "jest tests/unit",
|
|
12
|
+
"test:watch": "jest --watch",
|
|
13
|
+
"test:coverage": "jest --coverage",
|
|
14
|
+
"test:e2e": "jest tests/e2e --testTimeout=30000",
|
|
15
|
+
"test:live": "jest --config jest.config.live.js",
|
|
16
|
+
"test:live:verbose": "jest --config jest.config.live.js --verbose",
|
|
17
|
+
"test:all": "npm run test:unit && npm run test:e2e && npm run test:live",
|
|
18
|
+
"validate": "node scripts/validate-setup.js",
|
|
19
|
+
"verify": "node scripts/verify-capabilities.js",
|
|
20
|
+
"verify:taxonomy": "node scripts/verify-mixpeek-taxonomy.js",
|
|
21
|
+
"lint": "eslint src/",
|
|
22
|
+
"lint:fix": "eslint src/ --fix",
|
|
23
|
+
"docs": "jsdoc -c jsdoc.json",
|
|
24
|
+
"example": "cd examples/publisher-demo && npm install && npm start"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist/",
|
|
28
|
+
"src/",
|
|
29
|
+
"docs/",
|
|
30
|
+
"examples/",
|
|
31
|
+
"README.md",
|
|
32
|
+
"QUICKSTART.md",
|
|
33
|
+
"CHANGELOG.md",
|
|
34
|
+
"TESTING.md",
|
|
35
|
+
"ENDPOINTS.md",
|
|
36
|
+
"LICENSE"
|
|
37
|
+
],
|
|
38
|
+
"keywords": [
|
|
39
|
+
"prebid",
|
|
40
|
+
"contextual",
|
|
41
|
+
"advertising",
|
|
42
|
+
"mixpeek",
|
|
43
|
+
"ai",
|
|
44
|
+
"multimodal",
|
|
45
|
+
"iab",
|
|
46
|
+
"taxonomy",
|
|
47
|
+
"brand-safety"
|
|
48
|
+
],
|
|
49
|
+
"author": "Mixpeek",
|
|
50
|
+
"license": "Apache-2.0",
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "https://github.com/mixpeek/prebid.git"
|
|
54
|
+
},
|
|
55
|
+
"bugs": {
|
|
56
|
+
"url": "https://github.com/mixpeek/prebid/issues"
|
|
57
|
+
},
|
|
58
|
+
"homepage": "https://mixpeek.com",
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"prebid.js": ">=6.0.0"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@babel/core": "^7.23.0",
|
|
64
|
+
"@babel/preset-env": "^7.23.0",
|
|
65
|
+
"babel-loader": "^9.1.3",
|
|
66
|
+
"eslint": "^8.52.0",
|
|
67
|
+
"eslint-config-standard": "^17.1.0",
|
|
68
|
+
"eslint-plugin-import": "^2.29.0",
|
|
69
|
+
"eslint-plugin-node": "^11.1.0",
|
|
70
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
71
|
+
"jest": "^29.7.0",
|
|
72
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
73
|
+
"jsdoc": "^4.0.2",
|
|
74
|
+
"webpack": "^5.89.0",
|
|
75
|
+
"webpack-cli": "^5.1.4"
|
|
76
|
+
},
|
|
77
|
+
"dependencies": {},
|
|
78
|
+
"engines": {
|
|
79
|
+
"node": ">=14.0.0"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|