The Secure privacy script loads a client-side JavaScript object named 'sp' which exposes the following public methods.
Use these methods optionally to trigger your banners.
Name | Parameters | Description |
---|---|---|
sp.showPrivacyBanner(); | None | Forces the privacy banner to show. |
sp.hidePrivacyBanner(); | None | Forces the privacy banner to hide. |
sp.showTrustWidget(true); | true | Forces the trust widget to show. |
sp.hideTrustWidget(); | None | Forces the trust widget to hide |
sp.showCookieBanner(); | None | Forces the cookie banner to show |
sp.hideCookieBanner(); | None | Forces the cookie banner to hide |
sp.hidePrivacyPolicy(); | None | Forces the privacy policy popup to hide |
sp.showPrivacyPolicy(); | None | Forces the privacy policy popup to show |
sp.switchLanguage('lang_code'); | None | This method changes the language of all the banners. You need to pass 2 character language code, for example, 'en' or 'sv'. lang_code must be any language code that is activated for that domain. |
sp.switchLanguage('lang_code', | None | This method changes the language of the cookie banner. It overrides all the default settings and forces the cookie banner to show. |
window.addEventListener( | NA | This method is used to add a listener to the window, that will get fired when secure privacy is all initialized. |
window.addEventListener( | NA | This method is used to add a listener to the window, that will get fired when trust badge is shown or hidden |
window.addEventListener( | NA | This method is used to add a listener to the window, that will get fired when cookie banner is shown or hidden. the data which listener will get is |
window.addEventListener(
| NA | This method is used to add a listener to the window, that will get fired when cookie banner's buttons is clicked. the data which listener will get is |
window.addEventListener( | NA | This method is used to add a listener to the window, that will get fired when cookie banner's buttons is clicked and it is saved. the data which listener will get is |
window.addEventListener(
| NA | This method is used to add a listener to the window, that will get fired when privacy banner is shown or hidden. the data which listener will get is detail: { true/false } here "detail: true" will be for privacy banner is shown and "detail: false" will be for privacy banner is hidden. |
window.addEventListener(
| NA | This method is used to add a listener to the window, that will get fired when privacy banner's buttons is clicked. the data which listener will get is |
window.addEventListener(
| NA | This method is used to add a listener to the window, that will get fired when privacy banner's buttons is clicked and it is saved. the data which listener will get is |
window.addEventListener( | NA | This method is used to add a listener to the window, that will get fired when user changed language in privacy banner |
sp.cookieBannerVisible(); | NA | This function will return true when the cookie banner is visible on the screen, otherwise, it will return false. |
sp.savePluginConsent(pluginName); | pluginName | This method can be used to save consent for any particular plugin. The pluginName parameter expects a plugin name of type string. |
sp.allGivenConsents | NA | This object can be used to get all the consent of any user. This value is available on the window after the user has given consent. This JS object can be used to check the status of user consent and pass it to the Server |
window.addEventListener( "sp_unblock_Adobe", function (evt) { console.log(evt); },false); | NA | This event listener can be used to listen to unblock events of each Service name. The name of the event listener can be changed to reflect the Service name that you want to listen to. The Service names should be exactly the same as shown on the Scan Report. In case of spaces, replace it with an underscore (_) For example - To listen to Google Analytics you can use sp_unblock_Google_Analytics |
sp.checkConsent(pluginName) {} | pluginName | This method can be used to check consent for any particular plugin. The pluginName parameter expects a plugin name of type string. The return type of this function is boolean. |