Documentation index

Developers and API ›

Can I integrate the Cookie Policy within my website using the direct text embedding and API?


Similar to the privacy policy and its embedding options, you can also integrate the cookie policy using the direct text embedding option. This option will make your cookie policy look as if it were part of your own site. We offer multiple ways of embedding a cookie policy into the body of one of your pages. You can use javascript or call our API from your backend. There are four options:
  • Styled cookie policy
    • Embed via javascript
    • Embed via API from your backend
  • Clean HTML cookie policy with no styles
    • Embed via javascript
    • Embed via API from your backend
In order to achieve the direct integration of the cookie policy we need to use the same code used for the privacy policy and change it by adding /cookie-policy to the end of the privacy policy URL. embedding_options

Direct text embedding example (with style)

Here is an example of direct embedding of text with style. Please note that to proceed with this option you can use the same code used for as for your privacy policy, remembering to add to the url /cookie-policy. By using the "Legal text only" option, the cookie policy will be displayed directly in its full version. Click on "direct text embedding with style" to display the example. You'll notice that in this case the document fits your page in terms of size and style of text. You can also edit HTML and CSS to make it more in line with the appearance of your site/app.  

Direct text embedding with style

Cookie Policy In this case we used the following code to integrate the cookie policy in style:
<a href="//www.iubenda.com/privacy-policy/7842289/cookie-policy" class="iubenda-white iub-body-embed iubenda-embed" title="Cookie Policy">Cookie Policy</a>
<script type="text/javascript">(function (w,d) {var loader = function () {var s = d.createElement("script"), tag = d.getElementsByTagName("script")[0]; s.src = "//cdn.iubenda.com/iubenda.js"; tag.parentNode.insertBefore(s,tag);}; if(w.addEventListener){w.addEventListener("load", loader, false);}else if(w.attachEvent){w.attachEvent("onload", loader);}else{w.onload = loader;}})(window, document);</script>

Direct text embedding (with no style)

By adding the class iub-no-markup, the policy will be displayed with no predefined styles. If you want to integrate your cookie policy without style you should use an embedding code that looks like this:
<a href="//www.iubenda.com/privacy-policy/7842289/cookie-policy" class="iubenda-white iub-body-embed iub-legal-only iub-no-markup iubenda-embed" title="Cookie Policy">Cookie Policy</a>
<script type="text/javascript">(function (w,d) {var loader = function () {var s = d.createElement("script"), tag = d.getElementsByTagName("script")[0]; s.src = "//cdn.iubenda.com/iubenda.js"; tag.parentNode.insertBefore(s,tag);}; if(w.addEventListener){w.addEventListener("load", loader, false);}else if(w.attachEvent){w.attachEvent("onload", loader);}else{w.onload = loader;}})(window, document);</script>

API Documentation

The following API URLs are available:
www.iubenda.com/api/privacy-policy/:public_id/cookie-policy
www.iubenda.com/api/privacy-policy/:public_id/cookie-policy/no-markup
:public_id is the id of your privacy policy provided by your privacy policy embedding options. The response type is application/json and all the URLs are available in both http and https. Example:
curl --include --request GET 'http://www.iubenda.com/api/privacy-policy/:public_id'
Response: - Everything OK, response status 200:
{
:success     => true,
:content     => “… privacy policy content …"
}
- Required privacy policy is not found, response status 404:
{
:success      => false,

:error        => "Privacy Policy not found."
}
- Required privacy policy is not Pro, response status 403:
{
:success      => false,
:error        => "To access this privacy policy via API, convert it to Pro."
}
- Application error, response status 500:
{
:success     => false,
:error       => “Application Error. Please contact info@iubenda.com for support."
}
 

Still have questions?

Visit our support forum Email us