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's an example of what the "Direct text embedding" of the cookie policy looks like on a website.

For illustration purposes, we've pasted the embedding code below. Click on the "Direct embedding with style" for it to reveal the whole policy. As you can see, it adapts to your page in terms of typeface and size, and if you are an HTML/CSS expert you can always tweak the result by adding your custom CSS definitions to the classes used in the code.

Direct 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."
}

Other embedding options

The above are the options to embed the privacy policy into a page on your site. If you don't need that amount of control, you can instead use the button that will open up a modal window or go with a direct link.

embedding_options_links

Still have questions?

Visit our support forum Email us