When loaded onto your website, Axeptio will expose a JS instance of our class SDK, which contains useful methods and information. With this object your can customize properties at runtime or display any widget in your configuration.
Because the SDK is loaded asynchronically, it may be not present when you execute your own code. To be notified when the axeptioSDK object is ready, you have to use a variable named
_axcb(which stands for Axeptio Callbacks). Here's the snippet:
window._axcb = window._axcb || ;
// here you'll be able to access the methods and properties
// of the Axeptio SDK instance.
On the first line, we gain access to the
_axcbarray, if it's already there, or we create it. This is a shorthand technique to "access or create" a variable in JS.
Then we add a callback function inside the array using the
push()method. The inner part of the function will be executed only once Axeptio script is loaded and when the project's configuration has been fetched from our CDN. No worries if Axeptio is already loaded, your callback will then be called immediately.
When Axeptio is ready, it creates a few methods and objects directly onto the
- axeptioSDK instance of the SDK object
- axeptioBuildTimestamp date and time of build of the SDK script. Used to troubleshoot caching issues
- openAxeptioCookies(settings) call this function to open the cookies widget. You can pass an object with additional settings, like
userChoices. If you need to use these settings and need our help, contact us.
- showAxeptioButton() this function reveals the Axeptio Button on the corner of the page, if it's hidden.
- hideAxeptioButton() this function hides the Axeptio Button on the corner of the page, if it's visible.
Because the Axeptio SDK may not be loaded when you execute your own code, we recommend that you use the callback method.
Alias of openAxeptioCookies, this methods opens the cookies consent widget with the current cookiesVersion.
Create a regular checkbox for a corresponding Data Processing Consent Widget.
Create a consent button for a corresponding Data Processing Consent Widget.
Specify the cookies version to use. This method can be used at runtime to change between locales, for example.
Specify the user token to be used for subsequent consent collection.
Returns a boolean indicating whether the use agreed to the use of a specific vendor. Nota: the vendor is a string identifier you can specify in Axeptio's backoffice.
Request consent for a specific vendor. Returns a Promise that resolves when the consent is granted, and rejects when it's not.
An object containing the settings for the SDK (website related)
An object containing the preferences and utility methods to manage the users' preferences.
The complete configuration generated by our API when the project was published.
The template project used if Axeptio is used on a specific service (Typeform, etc.)