Iubenda logo
Start generating

Documentation

Table of Contents

API docs: Quick Generator Manual

The Quick Generator is a iubenda form/widget that can be integrated into any web app. It allows for privacy policies to be created right from your site.

The form requires only a a) website’s url or the name of a mobile application and b) an email address that will be associated with the generated privacy policy on our service. If the provided email address is already in iubenda’s database, we will ask for the account’s password to continue. In any other case the request will create a user account on iubenda.

Upon finishing this initial step, an email with setup instructions will be sent to the provided email address. Upon opening the link contained in the setup email, the user will be asked to set a password for his iubenda account.

The code that calls the Quick Generator will receive a js object containing all the info to finish the privacy policy on iubenda, the embedding code to use the privacy policy, or in the case of a privacy policy for mobile applications, the direct link to the generated privacy policy.

To integrate the Quick Generator you need to add the following javascript code:

<div id="iubenda-policy-config-start"></div>
<script type="text/javascript">
var _iub = _iub || []; // REQUIRED
_iub.quick_generator = { // REQUIRED. The element of the page to append the Quick Generator iframe badge to.
	placeholder:document.getElementById("iubenda-policy-config-start"), // REQUIRED
	input:{
		privacy_policy:{
			type:"mobile_app", // default 'web_site'. Available are  'mobile_app' and 'web_site'.
			url:"www.example.com", // default null
			app_name:"Example App", // default null
			pro:true, // default false. If subscription is available for api account, the policy will be always created Pro. 
			cookie_solution:true // optional, default 'false'; if provided 'true', a Privacy Controls and Cookie Solution will be created with a 25k pageviews/month free plan, if the user hasn't activated one yet. 

		},
		user:{
			email:"test@example.com" // default null
		}
	},
	callback:callbackFunc, // default null. Name of the function to be called once generation succeed.
	ok_message:"Please wait, the configuration is being saved...", // default null. Message to show in form once the generation process has completed.
	hide_last_close_btn:true, // default false. Hide the Close button at the bottom of the form when generation ends.
	api_key:"a6639fe1f277bbdad9ef1d92065a9da88cda008d", // REQUIRED
	language:'en', // default 'en'. Language of the form. Available are 'it' and 'en'
	no_style:true, // default false. If true, displays the button with no style applied
	css:"border:2px solid red;", // default null. Style to apply the quick generator button. Valid only if no_style is true
	caption:"Generate a privacy policy", // default "Generate a privacy policy with Iubenda" (en) and "Genera una privacy policy con iubenda" (it). Not language dependent.
	test:false // default false. When true, no update on iubenda db will be performed.
};
</script>
<script type="text/javascript" src="https://cdn.iubenda.com/quick_generator/loader.js"></script>

You can prefill the form with various optional configuration values, including the initial values (input.privacy_policy.url o input.privacy_policy.mobile_app e input.user.email).

You can also provide a list of languages in which you want the privacy policy to be generated. The languages list must be provided as an array of language codes for the configuration option parameter input.privacy_policy.langs, as shown in the example below. Allowed language codes are: “nl”, “en-GB”, “en”, “fr”, “de”, “it”, “pt-BR”, “ru” and “es”. If no language code is provided, US English (“en-US”) is assumed (see example above).

Furthermore, by setting the optional parameter cookie_solution: true, a Privacy Controls and Cookie Solution will be created with a 25k pageviews/month free plan if the user hasn’t activated one yet.

        ...
	input:{
		privacy_policy:{
			type:"mobile_app", 
			url:"www.example.com",
			app_name:"Example App", 
			pro:true, 
                        langs:['it','en'] // <= Array of languages codes
			cookie_solution:true // optional, default 'false'; if provided 'true', a Privacy Controls and Cookie Solution will be created with a 25k pageviews/month free plan, if the user hasn't activated one yet. 

		},
		user:{
			email:"test@example.com" 
		}
	},
        ...

The generated privacy policies (one per provided language) will be returned in the privacy_policies property of the JSON response (either in callback’s parameter or in _iub.quick_generator.output, see the example below about the quick generator output).

The minimal configuration for the form looks like this:

<div id="iubenda-policy-config-start"></div>
<script type="text/javascript">
var _iub = _iub || [];                                                					
_iub.quick_generator = {                                              				 
	placeholder:document.getElementById("iubenda-policy-config-start"), 		
	api_key:"a6639fe1f277bbdad9ef1d92065a9da88cda008d"   
};
</script>
<script type="text/javascript" src="https://cdn.iubenda.com/quick_generator/loader.js"></script>

To open or close the Quick Generator form via js:

  _iub.quick_generator.show();
  _iub.quick_generator.close();

Output

At the end of the generation process, if the parameter :callback was defined, the callback provided will be executed. In that case the output of the generation will be passed as a parameter. This output is available via the _iub global variable, in particular _iub.quick_generator.output – until the next generation.

// callback to be executed on return from QuickGeneration form. Passed as argument later below.
function callbackFunc(payload){
  // payload contains output data about generated pp (or pps), example given:
  payload => {
    privacy_policies:[
      {
        edit_url:"https://www.iubenda.com/en/privacy-policy-generator/1289/edit?l_email=example@iubenda.com&l_tok=ui7Rh91581T53Dgsl79z",
        // in case of mobile_app :direct_link is returned instead of :embed_code
        embed_code:"<a href="https://www.iubenda.com/privacy-policy/815115" class="iubenda-white no-brand iubenda-embed" title="Privacy Policy">Privacy Policy</a><script type="text/javascript">(function (w,d) {var loader = function () {var s = d.createElement("script"), tag = d.getElementsByTagName("script")[0]; s.src = "https://www.iubenda.com/assets/cdn/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>",
        // if not for a mobile_app, the :embed_code is returned instead fo :direct_link
        direct_link:"http://www.iubenda.com/privacy-policy/815115/full"
        id:1289,
        site_id:1295,
        lang:"en",
        public_id:815115,
        setup_url:"https://www.iubenda.com/en/privacy-policy-generator/1289/services?l_email=example@iubenda.com&l_tok=ui7Rh91581T53Dgsl79z"
      },
      //...
    ],
    user:{
      email:"example@test.com",
      id:108
    }
  }
}

Example:

function callbackFunc(payload) {
  console.log(_iub.quick_generator.output.privacy_policies[0].id);
  // or
  console.log(payload.privacy_policies[0].id);
  // ...
  // then, if needed
  _iub.quick_generator.close();
}

Or, alternatively via _iub.quick_generator, for an example see below:

_iub.quick_generator.output.privacy_policies[0].edit_url
_iub.quick_generator.output.privacy_policies[0].embed_code
_iub.quick_generator.output.privacy_policies[0].user.email

Working Example