Iubenda logo
Start generating

Documentation

Table of Contents

Adding iubenda’s Privacy Policy to Your Site: Direct Text Embedding and API

Available for: Advanced plan and Ultimate plan

The direct text embedding option makes your privacy policy look as if it were natively a part of your own site. On mobile apps the policy displays both the simplified version (on top) and the legal version (below) per default.

 

We offer multiple ways for embedding a privacy policy (with or without styling) into the body of one of your pages. You can:

  • copy and paste the JavaScript into your page, or
  • call our API from your backend.
Privacy policy - Direct Text Embedding

Note: uncheck the Simplified privacy policy option to directly show the complete version.

Caution

If you use html <base> tags to define your base URL, please note that your anchor links will also refer to the base URL. This is because doing so forces the set base URL as default and sets anchor links to [base]#anchor instead of [current page]#anchor. This could cause some internal linking issues when using the direct embedding method for your privacy policies. To fix this, you can either:

  • remove the base tags
  • grab the anchor and rewrite its link in javascript
    e.g.
    document.addEventListener("click", function(e) { if (e.target.tagName && e.target.tagName === 'A' && e.target.href.indexOf('#california_info') > -1) { window.open(window.location.href.split('#')[0] + '#california_info', '_self'); e.preventDefault(); } });
  • or use another embedding method.

JavaScript

Direct text embedding example (with style)

Click on the button below for an example. You’ll notice that 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.

Unchecking the “Simplified privacy policy” option the privacy policy will be displayed directly in its full version.

Direct embedding with style
Privacy Policy

Direct text embedding example (with no style)

By activating the “Use plain HTML with no styling (only shows the legal version)” option, the document will be displayed without any styles applied.

Direct embedding with no style
Privacy Policy

API

Full privacy policy embedding

These are the API URLs available to embed the full privacy policy from your backend:

  • https://www.iubenda.com/api/privacy-policy/:public_id
  • https://www.iubenda.com/api/privacy-policy/:public_id/only-legal
  • https://www.iubenda.com/api/privacy-policy/:public_id/no-markup

:public_id is the ID of your privacy policy provided by your privacy policy embedding options.

The JSON API doesn’t include the CSS provided by iubenda’s default privacy policies.

Example

curl --include --request GET 'https://www.iubenda.com/api/privacy-policy/:public_id'

Responses:

  • 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" }

Embedding only dynamic sections

If you already have your own privacy policy and prefer to use iubenda for dynamic parts only (clauses and services), you can use these API URLs.

Clauses and services:

  • https://www.iubenda.com/api/privacy-policy/:public_id/section/data-processing-detailed-info/only-legal
  • https://www.iubenda.com/api/privacy-policy/:public_id/section/data-processing-detailed-info/no-markup

Custom clauses and services:

  • https://www.iubenda.com/api/privacy-policy/:public_id/section/further-data/only-legal
  • https://www.iubenda.com/api/privacy-policy/:public_id/section/further-data/no-markup

:public_id is the ID of your privacy policy provided by your privacy policy embedding options.

To get your URLs just click on the Embed dynamic sections only checkbox you’ll find under “Options”:

Privacy and Cookie Policy - Embed dynamic sections only
Caution

The services section alone is not a complete privacy policy: the law has specific requirements for privacy policies which include valid identifying details and info on users’ rights. Read What Should Be in a Privacy Policy to find out the most basic elements that a privacy policy should have.

Other embedding options

iubenda’s privacy policy offers two other integration options:

If you would like to have additional questions answered regarding the embedding of your privacy policy in this way, please don’t hesitate to post it to our support forum.

See also