Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@financial-times/ads-personalised-consent
Advanced tools
A client side package to provide consent settings of personalised advertisement.
This package collects all the information related to privacy and generates an answer on whether different types of personalised advertisement is allowed. It takes into account of:
Typical usage would be to add the module to your app, call the imported method and then check whether the personalised advertisement is allowed:
import { getPersonalisedConsent } from "@financial-times/ads-personalised-consent";
async function onPageLoad() {
// create a fresh, updated instance of PersonalisedConsent, and get the privacy properties via getters
const pc = await getPersonalisedConsent();
const personalisedConsent = pc.isAllowed();
// check whether a certain type of personalised ads is allowed or not
if (personalisedConsent.behavioral) {
setupBehavioralAds();
} else {
blockBehavioralAds();
}
// alternatively, only update the privacy legislation properties and retrieve the new values
await pc.updatePrivacyLegislation();
const legislation = pc.getLegislation();
const region = pc.getRegion();
// similar for GPC value and consent cookie
pc.updateGpcValue();
const gpc = pc.getGpcValue();
pc.updateConsentCookie();
const consentCookie = pc.getConsentCookie();
...
}
Initialise the instance of PersaonalisedConsent
and update all the privacy related properties. Returns a Promise
which always resolves with the said instance.
Returns an Object
identifying whether different types of personalised ads (behavioural, demographic and programmatic) are allowed or not, based on
Privacy Legislation Client
returns error, it will consider the user is subject to all the policies available.)Name | Data-structure | Notes |
---|---|---|
behavioral | boolean | whether behavioral ads is allowed |
demographic | boolean | whether demographic ads is allowed |
programmatic | boolean | whether programmatic ads is allowed |
Returns the legislation
stored in the instance since last update, which is either
Set
of legislation which the user is subject to if Privacy Legislation Client
succeeds, or;undefined
if Privacy Legislation Client
throws error.Returns the region
stored in the instance since last update, which is either
string
identifying the region which the user is in if Privacy Legislation Client
succeeds, or;undefined
if Privacy Legislation Client
throws error.Returns a boolean
showing the GPC settings on the browser (which is Navigator.globalPrivacyControl
) stored in the instance since last update.
Returns an Object
identifying user's settings in FTConsent
cookie for different types of personalised ads (behavioural, demographic and programmatic) stored in the instance since last update.
Name | Data-structure | Notes |
---|---|---|
behavioral | boolean | FTConsent cookie exists and behaviouraladsOnsite:on is set |
demographic | boolean | FTConsent cookie exists and demographicadsOnsite:on is set |
programmatic | boolean | FTConsent cookie exists and programmaticadsOnsite:on is set |
Update all the privacy related properties. Returns a Promise
which always resolves.
Updates only legislation
and region
, and returns a Promise
containing
Name | Data-structure | Notes |
---|---|---|
legislation | Set of string OR undefined | a Set of legislation which the user is subject to if Privacy Legislation Client succeeds, otherwise undefined |
region | string OR undefined | a string identifying the region which the user is in if Privacy Legislation Client succeeds, otherwise undefined |
Updates only the GPC settings, and return a boolean
showing the latest GPC settings on the browser.
Updates only the user's settings in FTConsent
cookie for different types of personalised ads, and return an Object
identifying the settings.
Name | Data-structure | Notes |
---|---|---|
behavioral | boolean | FTConsent cookie exists and behaviouraladsOnsite:on is set |
demographic | boolean | FTConsent cookie exists and demographicadsOnsite:on is set |
programmatic | boolean | FTConsent cookie exists and programmaticadsOnsite:on is set |
FAQs
ads-personalised-consent =================
We found that @financial-times/ads-personalised-consent demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.