Back

JavaScript methods

#KB Privacy Cloud

JavaScript methods Various methods are provided for interaction with other functionalities of the website.This offers the possibility to control the pop-up or functionalities of the …

Back

JavaScript methods

Various methods are provided for interaction with other functionalities of the website.
This offers the possibility to control the pop-up or functionalities of the pop-up without interaction from the user, or to request status queries for consent.

Basically, all layouts offer the same methods. This means that the same basic functionality is available regardless of whether TCF mode is activated or not.

Methods

After initialization of the script by the browser, the following methods are available via the window object. For some layouts, it is also possible to call the methods via the window.legalweb.popup object (without the “lw” prefix).

Activate, deactivate and query the status of individual integrations

  • lwEnableIntegration(integrationId: string):void
  • lwDisableIntegration(integrationId: string):void
  • lwIsIntegrationEnabled(integrationId: string):bool

The value of the “data-slug” attribute of the switch in the pop-up is expected as the “integrationId”.

Activate, deactivate categories, query status

  • lwIsIntegrationCategoryEnabled(integrationId):bool
  • lwConsentIabIntegrations(categoryId: string, consentStatus: boolean):void
  • lwConsentIabIntegrations(consentStatus: boolean):void

The following methods simulate “clicks” on the buttons.

  • lwConsentAcceptSelected():void
  • lwConsentDenyAll():void
  • lwConsentIabIntegrations():void

Methods for displaying and closing the popup. Important: no other methods are executed that require consent or rejection.

  • lwShowPopup(options : {tab: string} = null):void
  • lwHidePopup():void
  • lwShowNotice():void
  • lwHideNotice():void

Insert embeddings dynamically

The following method can be used to dynamically create a placeholder for an embedding. A valid DOM node to which the placeholder is appended (via append) is expected as “nodeToAdd”. “integrationSlug” is the ID of the service (e.g. embeddings_youtube, embeddings_googlemaps). “callbackMethod” is the method that is executed as soon as the content is activated by the visitor (via consent). If consent has already been given, “callbackMethod” is executed immediately.
Intended use: e.g: Displaying a preview image of videos instead of the placeholder.

  • lwAddPlaceholderWithCallbackToNode(nodeToAdd, integrationSlug, callbackMethod):void

Manual initialization of the legal web JavaScripts

If popup and/or notice are not loaded via DOMContentLoaded event, a method for user-defined initialization is available. This method initializes the “complete” frontend, but does not yet display anything. In addition, the popup must also be displayed/called manually via the methods mentioned in the previous point.
“language” is the two-character abbreviation of the language (de, en, it, …)

  • lwCdnInit(language: string):void

Temporary deactivation of the Legalweb functions for a request

If the parameter lwDisableLegalweb is appended to a URL, no popup or notice is displayed, no integrations are loaded and no content is blocked.

Recommended articles

Integrate Matomo/Piwik Pro in a legally compliant manner: Use without consent in the GDPR?

Matomo (formerly known as Piwik) is an open source web analytics platform that is considered a privacy-friendly alternative to other ... Weiterlesen ...

Browser Fingerprinting and the GDPR

Browser fingerprinting is a technique used by websites and advertisers to track and identify a user’s device and online behavior based on information collected from their web browser. This information may include technical details about the device, software, and network, as well as user-specific information such as language preferences, time zone, and browsing history.

5 common GDPR myths debunked

The General Data Protection Regulation (GDPR) is a set of regulations introduced by the European Union (EU) in 2018 to ... Weiterlesen ...

Server side tracking GDPR compliant

How to implement server side tracking/tagging in compliance with the GDPR? What must be taken into account with regard to ... Weiterlesen ...
Privacy
The controller (legal web GmbH, Austria) would like to use the following services in order to process your personal data. Technologies such as cookies, localStorage, etc. can be used for personalization. This is not necessary for the use of the website, but allows us to interact with you more closely. If you wish, you can adjust or revoke your consent at any time via our privacy policy.