# @financial-times/ads-personalised-consent

> ads-personalised-consent =================

Latest version **7.5.1** (published 2026-05-18) · 0 weekly downloads

## Install

```sh
npm install @financial-times/ads-personalised-consent
pnpm add @financial-times/ads-personalised-consent
yarn add @financial-times/ads-personalised-consent
bun add @financial-times/ads-personalised-consent
```

## Health

**Score 55/100 (C)** — status: active.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 7.5.1 |
| Published | 2026-05-18 |
| First published | 2021-12-16 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | the-ft, rowanmanning, chee, alexwilson, aendra, emmalewis, notlee, seraph2000, hamza.samih, robertboulton, robgodfrey |

## Links

- npm: https://www.npmjs.com/package/@financial-times/ads-personalised-consent
- Homepage: https://github.com/Financial-Times/advertising#readme
- npm.io page: https://npm.io/package/@financial-times/ads-personalised-consent

## Dependencies (1)

- [@financial-times/privacy-legislation-client](https://npm.io/package/@financial-times/privacy-legislation-client.md) ^1.0.0

## Recent versions

- 7.5.1 (latest) — 2026-05-18
- 5.4.0-beta.5 (pre-release) — 2024-02-06
- 7.5.0 — 2026-05-08
- 7.4.0 — 2026-03-17
- 7.3.0 — 2025-10-22
- 7.2.1 — 2025-06-19
- 7.2.0 — 2025-06-16
- 7.1.0 — 2025-06-09
- 7.0.0 — 2025-06-03
- 6.6.0 — 2025-02-14
- 6.5.0 — 2025-01-16
- 6.4.0 — 2025-01-06
- 6.3.0 — 2024-11-26
- 6.2.0 — 2024-10-28
- 6.1.1 — 2024-10-17
- … 69 more at https://npm.io/package/@financial-times/ads-personalised-consent/versions

## README

ads-personalised-consent
=================

A client side package to provide consent settings of personalised advertisement.

## Functionality Overview
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:
- The privacy policy of the location which the user is in (e.g. California Consumer Privacy Act (CCPA) for California, US), which is collected from [Privacy Legislation Client](https://github.com/Financial-Times/privacy/tree/main/src/packages/legislation-client)
- The browser settings - e.g. [Global Privacy Control (GPC)](https://globalprivacycontrol.org/).
- The consents settings for _behavioral_, _demographic_ and _programmatic_ ads retrieved via the FTConsent cookie. Users can configure these settings via the [Manage Cookies page in FT.com](https://www.ft.com/preferences/manage-cookies), the [Manage Cookies page on the FT App](https://app.ft.com/manage_cookies) and the Manage Cookies pages on the specialist titles websites. These values can also be configured via the Cookie Banner displayed on FT.com, FT App or specialist titles. Yet another way to configure ads consent is via the [Privacy page on FT.com](https://www.ft.com/preferences/privacy)

## Use

Typical usage would be to add the module to your app, call the imported method
and then check whether the personalised advertisement is allowed:

```js
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();
  ...
}
```

## API

### getPersonalisedConsent()

Initialise the instance of `PersaonalisedConsent` and update all the privacy related properties. Returns a `Promise` which always resolves with the said instance.

### personalisedConsent.isAllowed()

Returns an `Object` identifying whether different types of personalised ads (behavioural, demographic and programmatic) are allowed or not, based on
- The privacy policy obtained from [Privacy Legislation Client](https://github.com/Financial-Times/privacy/tree/main/src/packages/legislation-client) (If `Privacy Legislation Client` returns error, it will consider the user is subject to all the policies available.)
- The browser settings for [Global Privacy Control (GPC)](https://globalprivacycontrol.org/)
- The consents settings for _behavioral_, _demographic_ and _programmatic_ ads retrieved via the FTConsent cookie.

| 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 |

### personalisedConsent.getLegislation()

Returns the `legislation` stored in the instance since last update, which is either
- a `Set` of legislation which the user is subject to if `Privacy Legislation Client` succeeds, or;
- `undefined` if `Privacy Legislation Client` throws error.

### personalisedConsent.getRegion()

Returns the `region` stored in the instance since last update, which is either
- a `string` identifying the region which the user is in if `Privacy Legislation Client` succeeds, or;
- `undefined` if `Privacy Legislation Client` throws error.

### personalisedConsent.getGpcValue()

Returns a `boolean` showing the GPC settings on the browser (which is `Navigator.globalPrivacyControl`) stored in the instance since last update.

### personalisedConsent.getConsentCookie()

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 |

### personalisedConsent.update()

Update all the privacy related properties. Returns a `Promise` which always resolves.

### personalisedConsent.updatePrivacyLegislation()

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` |

### personalisedConsent.updateGpcValue()

Updates only the GPC settings, and return a `boolean` showing the latest GPC settings on the browser.

### personalisedConsent.updateConsentCookie()

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  |

---
_Source: https://npm.io/package/@financial-times/ads-personalised-consent · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
