SDK Methods

Prev Next

Under window.bigidcmp you will find the following API:

setLanguage

This method changes the language used in the banner. It fires the bigidcmp:language_changed event.

setLanguage(language)

Parameter

Required

Values

Description

language

Yes

'ar', 'bg', 'cs', 'da', 'de', 'el', 'en', 'en-gb', 'es', 'fi', 'fr', 'he', 'hr', 'hu', 'it', 'nb', 'nl', 'pl', 'pt', 'pt-pt', 'ro', 'ru', 'sk', 'sl', 'sr', 'sv', 'th', 'tr', 'ua', 'ca', 'fr-ca'

ISO Code for the language to be used in the banner.

window.bigidcmp.setLanguage('de');

getConsent

This method obtains the consent state.

getConsent()

Returns object with:

Property

Required

Values

Description

consent-id

Yes

string

ID for the consent.

marketing

Yes

boolean

Whether consent for marketing tools is enabled or not.

preferences

Yes

boolean

Whether consent for preferences tools is enabled or not.

statistics

Yes

boolean

Whether consent for statistics tools is enabled or not.

optedIn

Yes

boolean

Only present in US opt-out model. True, if "Don't sell my data" is off. False otherwise.

userId

No

string

The user ID for the consent if the user was identified.

window.bigidcmp.getConsent();

showWidget

This method opens the consent widget. If using the US opt-out model + Notice mode, the "Don't sell my data" notice will be shown. If not, the banner will be rendered. It fires the bigidcmp:widget_opened event.

showWidget()

window.bigidcmp.showWidget();

identify

This method identifies the consent with the User ID sent. It makes the consent cross-device. Check the Authenticated Visitor Use Case. It fires the bigidcmp:identity_added event.

identify(userId)

Parameter

Required

Values

Description

userId

Yes

string

The ID for the user you are identifying. It is managed by you.

window.bigidcmp.identify('123');

removeIdentity

This method removes the identity being used. It makes BigID use an anonymous consent again. Check the Authenticated Visitor Use Case. It fires the bigidcmp:identity_removed event.

removeIdentity()

window.bigidcmp.removeIdentity();

refreshWidget

This method refreshes the UI of the widget. It fires the bigidcmp:widget_refreshed event.

refreshWidget()

window.bigidcmp.refreshWidget();

googleConsentMode.examine

This method examines whether a default or update consent command of Google Consent Mode was set before any tag loads or not. It returns the following object:

interface Result {
  loadedOnTime: boolean;
  previousEvents: Array<any>;
};

If the property loadedOnTime is set to true, then the implementation is correctly done. Otherwise, the property previousEvents will have a list of all the dataLayer events fired before the Google Consent Mode is properly initialized. This array will give you hints of the tags that are being fired before BigID's banner has the chance to set the consent types as it should.

If loadedOnTime is set to false and yet previousEvents is empty, then the tags being fired before Google Consent Mode is initialized are probably being wrongly configured in Google Tag Manager. Preview your website with Google Tag Assistant and you should see the next error message under the Consent tab:

Tag Assitant Error

googleConsentMode.examine()

window.bigidcmp.googleConsentMode.examine();