1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| // document.browsingTopics() returns an array of up to three topic objects in random order.
const topics = await document.browsingTopics();
// The returned array looks like: [{'value': Number, 'taxonomyVersion': String, 'modelVersion': String}]
// Get data for an ad creative.
const response = await fetch('https://ads.example/get-creative', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(topics)
});
// Get the JSON from the response.
const creative = await response.json();
// Display ad. |
Partager