Newskit Logo
About

Consent

Overview

The consent component is a non-visual component for the consent of the use of 3rd party cookies. It triggers the loading of a Sourcepoint CMP (Content Management Platform) dialog to allow the user to decide what 3rd party cookies they wish to allow or disallow on their browser. Unless you are utilising React Helmet, it must be placed inside the body of the document during server-side rendering. NewsKit has both an AMP and non-AMP version of this component. The two are not interchangeable so you must ensure you use the correct one.

At the moment this component is supporting two version of the Sourcepoint config. Versions GDPR TCF V2 and GDPR Non-TCF.

Prerequisites

To utilise this component you will need to have a Sourcepoint account and, if required, a Sourcepoint messaging subdomain set up. For more detailed information please see Sourcepoint documentation TCF V2 or documentation Non-TCF.

Usage

Props GDPR TCF V2

sourcePointConfigTCFV2
The config object that initialises SourcePoint. See Sourcepoint documentation for a full reference.
accountIdnumber
The accountId value associates the property with your organization's Sourcepoint account. Your organization's accountId can be retrieved by contacting your Sourcepoint Account Manager or via the My Account page in your Sourcepoint account.
targetingParamsobject
Targeting params allow a developer to set arbitrary key/value pairs. These key/value pairs are sent to Sourcepoint servers where they can be used to take a decision within the scenario builder.
isSPAboolean
When set to true, will confirm the implementation for a single page application and will show a message only when window._sp_.executeMessaging();is triggered.
Note: window._sp_.executeMessaging(); is supposed to be called on each (virtual) pageload.
mmsDomainstring
has been replaced by the new baseEndpoint parameter for optimization reasons. This change is completely backwards compatible. However, it is recommended that older implementations move to the new parameter to benefit from the optimizations.
wrapperAPIOriginstring
has been replaced by the new baseEndpoint parameter for optimization reasons. This change is completely backwards compatible. However, it is recommended that older implementations move to the new parameter to benefit from the optimizations.
propertyHrefboolean
Maps the implementation to a specific URL as set up in the Sourcepoint account dashboard.
baseEndpointstring
is a single server endpoint from where the messaging as well as the GDPR and TCFv2 experience is served. The baseEndpoint can also be changed to a CNAMED 1st party subdomain in order to persist 1st party cookies on Safari web browser (due to Safari’s ITP) by setting cookies through the server with "set-cookie" rather than using "document.cookie" on the page. Changing the baseEndpoint domain is optional but recommended!
groupPmIdnumber
Allows your organization to use the Privacy Manager ID for the property group use of a property group's Privacy Manager ID.
Note: Call window._sp_.loadPrivacyManagerModal() without passing a parameter and the Privacy Manager that displays will be that property's version of the groupPmId Privacy Manager.
waitForConsentboolean = false
When true (the default value), the consent component will cause prebid.js to wait for user consent to be provided before it initialises.
reactHelmetreact-helmet Helmet Component
By default the Consent component will inject its scripts by rendering script tags. However, if your project is using  React Helmet  you can pass the Helmet component in and the scripts will render using that component.
eventsobject
An array of events that allow Javascript callbacks to be triggered. Please refer to the Optional Callback document to learn more about how to use events as part of your setup configuration.
consentLanguagestring
If this parameter is not present, stacks and purposes will appear according to the end-user's preferred browser language setting.consentLanguage: "nl"

Props GDPR Non-TCF

SourcePointConfigNonTCFV1
The config object that initialises SourcePoint. See Sourcepoint documentation for a full reference.
accountIdnumber
The accountId value associates the property with your organization's Sourcepoint account. Your organization's accountId can be retrieved by contacting your Sourcepoint Account Manager or via the My Account page in your Sourcepoint account.
baseEndpointstring
The baseEndpoint can also be changed to a CNAME first-party subdomain in order to persist first-party cookies on Safari web browser (due to Safari’s ITP) by setting cookies through the server with set-cookie rather than using document.cookie on the page.
isSPAboolean
When set to true, will confirm the implementation for a single page application and will show a message only when window._sp_.executeMessaging();is triggered.
Note: window._sp_.executeMessaging(); is supposed to be called on each (virtual) pageload.
groupPmIdnumber
Allows your organization to use the Privacy Manager ID for the property group use of a property group's Privacy Manager ID.
Note: Call window._sp_.loadPrivacyManagerModal() without passing a parameter and the Privacy Manager that displays will be that property's version of the groupPmId Privacy Manager.
propertyHrefstring
Maps the implementation to a specific URL as set up in the Sourcepoint account dashboard.
propertyIdstring
Maps the message to a specific property (website, app, OTT) as set up in the Sourcepoint account dashboard.
targetingParamsobject
Targeting params allow a developer to set arbitrary key/value pairs. These key/value pairs are sent to Sourcepoint servers where they can be used to take a decision within the scenario builder.
eventsobject
Click here for all optional event callbacks that are supported by Sourcepoint for GDPR non-TCF web implementations.
consentLanguagestring
If this parameter is not present, stacks and purposes will appear according to the end-user's preferred browser language setting.consentLanguage: "nl"

How to run on localhost

The minimum parameters for the Consent component to run locally are a sourcePointConfig object with accountId and siteHref for TCFV1 and with an accountId and propertyHref for TCFV1. The siteHref or propertyHref property should be an url that that exists in your account's property group. Contact your sourcepoint account manager.

In a V2 example it would look like this:

1<Consent
2    sourcePointConfigTCFV2={{
3      accountId: accountId,
4      propertyHref: 'http://newskit.co.uk/'
5    }}
6  />

Consent button

By setting renderConsentButton to false the default consent button will be hidden. This component can be use intead. It gives the flexibilty to place anywhere on the page.

settingsButtonTextstring = Privacy Settings
Consent button label text
postPromptUIstring = privacy-settings-prompt
As this prop connects the consent button to the consent component, the value of this prop needs to match with the value provided in the consent component.