setUSPLink
Functionality
The function setUSPLink
is used to enable a custom link, integrated in the page, to manage CCPA consent.
Syntax
function adconsent.ccpa()
argument name | type | optional | value | description |
---|---|---|---|---|
command | string |
|
|
|
parameter | string or DOM element |
| e.g. | The CCPA element ID given by the publisher in his page or the DOM element itself. |
callback | function | ✔️ |
| The callback function that is called with the function call result. |
Description
The Adconsent CCPA GUI can be displayed in two ways:
Floating button in the bottom left corner (default)
A custom link integrated in the page, for example a page footer link (recommended)
Having a floating button in the page is not ideal when thinking about user experience. A button that is not really part of the page content and context. This can also lead to worse consent opt-in rates.
The custom link is recommended as it provides a better user experience, which in turn results into better opt-in consent rates.
The function setUSPLink
enables the custom link and binds the CCPA consent management to the provided div element. If a user is under the CCPA privacy law, AdConsent will show the div element to the user to manage the consent. If the user is outside of CCPA, the link will not be changed.
The div element for the CCPA link needs to be created on the page and should be hidden by default, so it will be only shown by AdConsent when required.
Floating button example
The CMP for CCPA shows a floating button by default which triggers the CMP popup in order to manage consent. This button has the default label "Do not share my Personal Information", as shown in the picture below:
Custom link example
A div element is created on the page which is labeled "Do not sell my data" and then linked to AdConsent using setUSPLink
. The link is only visible in the CCPA consent region.
Such a configuration leads to a complete integration for the CCPA CMP into the page layout, as shown in the picture below:
Scope
The function must be called before AdConsent is started. Calls after AdConsent has started will be ignored.
Examples
Setting the CMP to use a div with id "ccpa"
A div element is created, for example in the footer section of the page, with the id 'ccpa'. The element must be hidden by default.
<div style="display:none" id="ccpa"><span>Don't Sell Personal Data</span></div>
Linking the div element to the CCPA consent management.
adconsent.ccpa('setUSPLink', 'ccpa');
Setting the CMP to use the DOM element holding the div where the CCPA link should be clicked to open the CMP GUI
// creating the CCPA div element using JavaScript
var ccpaLink = document.createElement('div');
ccpaLink.innerHTML = "Do not sell my data";
ccpaLink.style.cssText = "display:none"
var footer = document.getElementById('footerSection');
footer.appendChild(ccpaLink);
// link the div element
adconsent.ccpa('setUSPLink', ccpaLink);
Note
The display:none
style needs to be applied inline to the element, otherwise it will not be visible when the CCPA is triggered.