Axeptio Javascript SDK

Accessing the Javascript SDK on your website

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.

Using a callback function to get a reference to the SDK

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 _axcb array, 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.

Alternative: using the window.axeptioSDK object

When Axeptio is ready, it creates a few methods and objects directly onto the window scope.

  • 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 currentStepIndex, onComplete, onEvent, 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.

Anatomy of the Axeptio SDK.



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.

sdk.requestConsent(vendor, onConsent)

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.)

Last updated