Skip to main content
All CollectionsFAQ ❓️❓️Widget and Cookies
How do you generate a vendors list to display on a page?

How do you generate a vendors list to display on a page?

M
Written by Manon Manso
Updated over a week ago

Do you want to generate a list of vendors in HTML that can, for example, be displayed on your privacy policy page?

To do this, it's very simple!

All you have to do is copy the following script, and you're done 💪🏼.

function renderAxeptioVendorsToPage(element) {
var html;
window._axcb = window._axcb || [];
window._axcb.push(function (sdk) {
html = sdk.getCookiesConfig().steps.map(function (step) {
if (step.layout === "category" || step.layout === "info") {
const vendors = step.vendors.map(function (vendor) {
return (
"<div>" +
"<h4>" +
vendor.title +
"</h4>" +
'<p class="shortDescription">' +
(vendor.shortDescription || "") +
"</p>" +
'<p class="longDescription">' +
(vendor.longDescription || "") +
"</p>" +
'<a href="' +
vendor.policyUrl +
'" class="policyUrl">Privacy Policy</a>' +
"</div>"
);
});
return (
"<div><h3>" +
step.title +
'</h3><div class="vendors">' +
vendors.join() +
"</div></div>"
);
}
});
if (typeof element === "string") {
element = document.querySelector(element);
}
if (element instanceof Element) {
element.innerHTML = html.join("");
}
});
}

renderAxeptioVendorsToPage("#text");
Did this answer your question?