@financial-times/ads-display
Advanced tools
Comparing version 4.0.0-beta.16 to 4.0.0-beta.17
@@ -507,2 +507,11 @@ 'use strict'; | ||
/** | ||
* @typedef {Object} oAdsMetricPayload | ||
* @property {string} category | ||
* @property {string} action | ||
* @property {Object} timings | ||
* @property {Object} creative | ||
* @property {Object} advert | ||
*/ | ||
// Probability that a page view is chosen to be send ads-related metrics | ||
// This sampling is ignored by `setupMetrics` if the `ignoreSampling` | ||
@@ -554,11 +563,18 @@ // parameter is true | ||
function setupMetrics(ignoreSampling) { | ||
const callback = async ({ | ||
advert = {} | ||
} = {}) => { | ||
/** | ||
* @param {oAdsMetricPayload} payload | ||
* @returns | ||
*/ | ||
const callback = async payload => { | ||
const uscookie = privacyUsPrivacy.getUsPrivacyForTracking(); | ||
const consents = (await getConsentsForTracking()) || {}; | ||
consents.usprivacy = uscookie; | ||
return nTracking.broadcast('oTracking.event', { ...advert, | ||
consents | ||
}); | ||
if (payload) { | ||
payload.advert = { ...payload.advert, | ||
consents | ||
}; | ||
} | ||
return nTracking.broadcast('oTracking.event', payload); | ||
}; | ||
@@ -565,0 +581,0 @@ |
@@ -495,2 +495,11 @@ import oAds from '@financial-times/ads-legacy-o-ads'; | ||
/** | ||
* @typedef {Object} oAdsMetricPayload | ||
* @property {string} category | ||
* @property {string} action | ||
* @property {Object} timings | ||
* @property {Object} creative | ||
* @property {Object} advert | ||
*/ | ||
// Probability that a page view is chosen to be send ads-related metrics | ||
// This sampling is ignored by `setupMetrics` if the `ignoreSampling` | ||
@@ -542,11 +551,18 @@ // parameter is true | ||
function setupMetrics(ignoreSampling) { | ||
const callback = async ({ | ||
advert = {} | ||
} = {}) => { | ||
/** | ||
* @param {oAdsMetricPayload} payload | ||
* @returns | ||
*/ | ||
const callback = async payload => { | ||
const uscookie = getUsPrivacyForTracking(); | ||
const consents = (await getConsentsForTracking()) || {}; | ||
consents.usprivacy = uscookie; | ||
return broadcast('oTracking.event', { ...advert, | ||
consents | ||
}); | ||
if (payload) { | ||
payload.advert = { ...payload.advert, | ||
consents | ||
}; | ||
} | ||
return broadcast('oTracking.event', payload); | ||
}; | ||
@@ -553,0 +569,0 @@ |
{ | ||
"name": "@financial-times/ads-display", | ||
"version": "4.0.0-beta.16", | ||
"version": "4.0.0-beta.17", | ||
"description": "Bring ads to your page with the FT specific o-ads configuration", | ||
@@ -50,6 +50,6 @@ "main": "dist/ads-display.cjs.js", | ||
"dependencies": { | ||
"@financial-times/ads-legacy-o-ads": "^4.0.0-beta.16", | ||
"@financial-times/ads-moat-integration": "^4.0.0-beta.16", | ||
"@financial-times/ads-permutive": "^4.0.0-beta.16", | ||
"@financial-times/ads-personalised-consent": "^4.0.0-beta.16", | ||
"@financial-times/ads-legacy-o-ads": "^4.0.0-beta.17", | ||
"@financial-times/ads-moat-integration": "^4.0.0-beta.17", | ||
"@financial-times/ads-permutive": "^4.0.0-beta.17", | ||
"@financial-times/ads-personalised-consent": "^4.0.0-beta.17", | ||
"@financial-times/n-tracking": "4.0.1", | ||
@@ -56,0 +56,0 @@ "@financial-times/o-tracking": "^4.0.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71269
1590