Digital Governance
cancel
Showing results for 
Search instead for 
Did you mean: 

Consent Solutions Knowledge Base

UCP Javascript API Part 2/3

Supported API Functionality

window.evidon namespace

There are a few properties located at the root, window.evidon, portion of the API. The following are supported values which can be located that object.

Properties

Property

Description

notice

The notice object. Modifying this value directly is not supported.

id

This is your company identifier. We do not support modifying this value, it should be treated as read-only.

userid

Use this property to assign any identifier you would like for the currently active user. For example, if you have an internal user id value for the user you can place it here and we will store that information with our reporting information.

banner

Reference to the active banner object if available. This property should be treated as read-only and modifications are not supported. This will only be set if a banner needs to be displayed to gather consent.

barrier

Reference to the active barrier object if available. This property should be treated as read-only and modifications are not supported. This will only be set if a barrier needs to be displayed to gather consent.

gdprL2

Reference to our “L2” object, which is used to display the more advanced consent gathering mechanisms (such as gdpr support, IAB support, etc.). This will only be set if the L2 is activated and should be treated as a read-only value. Modifications are not supported.

cmp

Reference to our “cmp” object which powers the IAB __cmp api. This object should be treated as read-only and not modified.

preferencesDialog

This is the latest version of our “L2” and is used to display more advanced consent information. This object should be treated as read-only and modifications are not supported.

Location

This contains the country information pulled from our geo- location script. It will only have a value if the country.js script arrives before our main script api is available so should not be used as a reliable mechanism to determine the active country location.

Themes

Contains the object holding the theme information used to power the UI displays. This should be treated as a read-only property as modifications are not supported.

consentTemplates

This is a list of the different consent combinations defined for the current domain settings. This is only for internal use and should be treated as a read-only property and not modified in any way.

link

Reference to the object that controls our consent link access. This should be treated as a read-only property and not modified.

button

Reference to the object that controls our consent button access. This should be treated as a read-only property and not modified.

events

This is an internal event queue and should be treated as read- only and not modified in any way.

window.evidon.notice namespace Properties

The following properties can be used from the window.evidon.notice object. These properties are provided to provide access to information that might be valuable to other scripts running on the page, but should be considered READ-ONLY. Any properties that can be modified at runtime will have a supported API method to allow that. For example, you can use the setLocation() method to change the country on the notice.

Property

Description

country

The currently active country object.

languageCode

The active language code.

languageRoot

The active root languge. This is used to pull the correct set of translation values.

activeTranslations

The object holding the currently active set of translations.

settings

The settings object holding all the possible settings for the current domain.

domain

The active domain

activeSettings

The object holding the currently active settings for the notice.

consentTypeId

The identifier indicating the type of consent is active for this notice:
1: no consent
2: banner consent

3: barrier consent

privacyAccessTypeId

The identifier indicating the type of privacy tool access mechanism to show:
1: link
2: button

consentIsGiven

Flag indicating whether the active user has provided consent.

 

 

Methods

The following list of methods are supported under the window.evidon.notice namespace.

appendScript(url, callback)

url: the url to add to the script “src” attribute.
callback: an optional function to call once the script has finished loading.

Call this API method to append a script to the current document.

dropPixel(actionTypeId)

actionTypeId: the action identifier for the reporting ping to execute.

This method drops a reporting “ping” to the current document. This information is used to provide our customers insight into what the scripts are doing on their pages. In general we recommend against executing any reporting calls through your scripts, but if there is a legitimate need you can use this method to do it.

A “gotcha”. We will only execute any reporting action one time. So if we have already recorded a specific action and you call this method again, it will not record the same action a second time.

consentGiven()

Calling this method will instruct our script to drop the consent cookie and execute any consent callback/tag manager functionality. Use this call if you are going to provide a consent mechanism not currently supported by our scripts (your own consent button for example).

getConsentUrl()

Returns the url to the consent tool for this notice. You can use this method to get the raw url, but we suggest using the “showConsentTool” method to actually display the consent tool.

showConsentTool()

Instructs our consent tool to be displayed based on the currently defined rules (overlay vs. new window for example). This is the recommended method to use if you are going to build your own access to our consent tool.

isMobile()

Just a helper method which returns true if we are running on a mobile device and false for a desktop. If you need to match any mobile vs. desktop logic from your scripts to ours we recommend using this method to check for mobile device execution.

showNotice()

Call this to display the notice. This is the primary method called to run all the logic and make all the checks necessary to display our notice elements based on the current environment settings (country, language, etc.). It would be unusual for any customer to need to call this from their script methods, but it is available if you need to.

setLocation(locationObj)

locationObj: the json object containing the details for the location you want to use. The format of the object is:

{'code':'us','id':1,'defaultLangauge':'en-us'}

This method is called to set the notice location (country). If you need to override the country settings for some reason you can use this method to accomplish that.

setThemes(themes)

themes: object structure containing the theme details you want to use.

It is highly recommended you not use this method. The theme structure is relatively complex and is identifier based, so you would need to match everything up perfectly. However, if you need to tackle this for some reason it is available.

activeTranslations(code)

code: language code to make the active translation set

Use this method if you want to force a specific language set that is different from the user browser settings. A typical example would be a site that uses a dropdown to switch between languages where you want to force the consent messaging to match your site instead of the browser settings.

loadSettings(settingsObj)

settingsObj: the json object structure containing the settings to use for the current notice.

This is another method that is available but we highly recommend not using. The setting structure is complex and needs to correlate the identifiers between the various translations and theme elements.

continued...

Labels (3)
Version history
Revision #:
1 of 1
Last update:
‎04-22-2019 12:20 PM
Updated by:
 
Contributors
Looking for more?
Ask in Discussions
Developers

Peer-to-peer support  and answers on developing CMS templates, modifying privacy scripts or building integrations.

Digital Experience Management

Find answers and ask questions on content management, personalization and targeting.

Digital Quality Management

Find answers and ask questions on WCAG and SEO quality management.

Digital Governance

Find answers and ask questions on consent and monitoring solutions.