The Chrome AI RTD Provider is a Prebid.js Real-Time Data (RTD) module that enhances bidding by leveraging Chrome’s built-in AI capabilities. It can automatically detect page language using the Chrome AI Language Detection API and generate page summaries or keywords using the Chrome AI Summarizer API. This information is added to the OpenRTB bid request objects, allowing bid adapters to optimize bids based on content language and context.
To include the Chrome AI RTD Provider in your Prebid.js build, use the following command:
gulp build --modules=rtdModule,chromeAiRtdProvider
Add the Chrome AI RTD Provider to your Prebid.js configuration:
pbjs.setConfig({
realTimeData: {
dataProviders: [{
name: 'chromeAi',
waitForIt: true // Optional: delays the auction until language detection completes
}]
}
});
Configure language detection and summarization with additional options:
pbjs.setConfig({
realTimeData: {
dataProviders: [{
name: 'chromeAi',
waitForIt: true, // Set to true if auction should wait for both enabled features
params: {
languageDetector: {
enabled: true, // Set to false to disable language detection
confidence: 0.9, // Set minimum confidence threshold (0.0 - 1.0)
ortb2Path: 'site.content.language' // Default path for language
},
summarizer: {
enabled: false, // Set to true to enable summarization/keyword generation
type: 'headline', // 'headline','key-points', 'tldr' or 'teaser'
format: 'markdown', // 'plain-text' or 'markdown'
length: 'short', // 'short', 'medium', or 'long'
ortb2Path: 'site.content.keywords', // Path for summary/keywords
cacheInLocalStorage: true // Whether to cache generated summary/keywords
}
}
}]
}
});
Parameter | Scope | Type | Description | Default |
---|---|---|---|---|
waitForIt |
Optional | Boolean | Whether to delay auction for data retrieval | false |
languageDetector.enabled |
Optional | Boolean | Enable or disable language detection | true |
languageDetector.confidence |
Optional | Number | Minimum confidence threshold for detected language (0.0 - 1.0) | 0.8 |
languageDetector.ortb2Path |
Optional | String | Path in ORTB2 to store the detected language | 'site.content.language' |
summarizer.enabled |
Optional | Boolean | Enable or disable summarization/keyword generation | false |
summarizer.type |
Optional | String | Type of summary: 'headline' , 'key-points' , 'tldr' , or 'teaser' |
'headline' |
summarizer.format |
Optional | String | Format of the summary: 'plain-text' or 'markdown' |
'mark-down' |
summarizer.length |
Optional | String | Length of the summary: 'short' , 'medium' , or 'long' |
'short' |
summarizer.ortb2Path |
Optional | String | Path in ORTB2 to store the generated summary/keywords | 'site.content.keywords' |
summarizer.cacheInLocalStorage |
Optional | Boolean | Whether to cache the generated summary/keywords in localStorage | true |
The module initializes configured features (language detection, summarization) asynchronously.
languageDetector
)getBidRequestData
is called, the module first checks for existing language information in this order:
reqBidsConfigObj
passed to getBidRequestData
).availability()
method is checked. If ‘unavailable’, detection is skipped. If ‘after-download’, the module may proceed if the model downloads.languageDetector.ortb2Path
(default: site.content.language
).summarizer
)cacheInLocalStorage: true
).availability()
method is checked. If ‘unavailable’, summarization is skipped. If ‘after-download’, the module may proceed.cacheInLocalStorage: true
).summarizer.ortb2Path
(default: site.content.keywords
).If waitForIt: true
is set in the RTD config, the auction will be delayed until all enabled and available Chrome AI features complete their processing.
waitForIt: true
option, consider the potential impact on auction latency.pbjs.setConfig({
realTimeData: {
dataProviders: [{
name: 'chromeAi',
waitForIt: true
}]
}
});
pbjs.setConfig({
realTimeData: {
dataProviders: [{
name: 'chromeAi',
params: {
languageDetector: {
enabled: false
}
}
}]
}
});
pbjs.setConfig({
realTimeData: {
dataProviders: [{
name: 'chromeAi',
waitForIt: true,
params: {
languageDetector: {
enabled: true,
confidence: 0.95 // Only use high-confidence detections
}
}
}]
}
});
pbjs.setConfig({
realTimeData: {
dataProviders: [{
name: 'chromeAi',
waitForIt: true,
params: {
languageDetector: {
enabled: false // Example: only using summarizer
},
summarizer: {
enabled: true,
type: 'teaser',
format: 'markdown', // In markdown format
length: 'medium',
ortb2Path: 'site.ext.data.summary', // Custom ORTB2 path
}
}
}]
}
});