Skip to main content

A simple checkbox

Written by Alexandre Dias Da Silva

If our widgets are a bit too large for you, we have an alternative.

By default, we recommend using widgets to collect consent. But in certain cases, when space is limited or when you want to have full control over your form design, you may prefer to display a simple checkbox. We have a solution for that!

To display a simple checkbox, you will need to use some Javascript code. This code can be added in the same way you load our Axeptio code snippet. This is necessary because to create this checkbox you will need to associate it with the identifier of your marketing data processing.

You will first need to access the Axeptio SDK object. For this, we recommend using the _axcb stack. This is a Javascript array that is processed by Axeptio when it loads.

// we initialize the array if it is not already declared
window._axcb = window._axcb || [];
// we add our callback:
window._axcb.push(function(axeptioSDK){
// this portion of the code will be called once
// all the Axeptio configuration has been downloaded

// And here we will create the checkbox
axeptioSDK.createConsentCheckbox({
service: 'processings',
identifier: "put the identifier of the checkbox here",
node: document.getElementById("Put here an ID to the element in which the checkbox will be created"),
embed: {
checkboxText: "I accept the personal data usage policy",
checkboxDetailsText: "learn more"
}
});
});
Did this answer your question?