GDPR

Record user information about EU visitors.

📘

IMPORTANT NOTE

This API is deprecated and works only for projects created before 1st of April 2022 (consent version 1). There is an ongoing transition period until the 1st of June 2022 in which you should migrate to the new API described in Consent sensitive data section.
After the period old API will no longer work and any call will show only a warning with a link to this documentation.

Project's consent version can be found in project detail (screenshot below).
Personal data collection settings changes from consent version 1 to consent version 2 can be seen at screenshot below.

Project detail with consent versionProject detail with consent version

Project detail with consent version

Personal data collection settings (consent v1 and consent v2)Personal data collection settings (consent v1 and consent v2)

Personal data collection settings (consent v1 and consent v2)

📘

Make sure you enabled the corresponding project settings before using this API.

Verify user consent

Read more about GDPR in our HELP section. Once the user gave consent, you can use this API. The code below needs to be adjusted based on the user's answer.

At Smartlook we use a pop-up window to ask for user consent. You should implement a similar solution on your site.

Verify if a visitor gave their consent or not:

<script>
  smartlook(function() {
    console.log(smartlook.consent.api)
    console.log(smartlook.consent.forms)
    console.log(smartlook.consent.ip)
  });
</script>

There are 3 possible values that you can see in the console:

  • true if user agreed and provided consent
  • false if user refused to provide consent
  • null if user was not asked for consent yet

Form inputs

User consented to have their form inputs recorded.

<script>
  // in this variable insert your consent
  var consentText = 'Here goes consent text from your website.';

  // choose only one variable
  var clientDecision = true; // if user agreed and provided consent
  var clientDecision = false; // if user refused to provide consent

  smartlook('consentForms', clientDecision ? consentText : false);
</script>

IP address

User consented to have their IP address recorded.

<script>
  // in this variable insert your consent
  var consentText = 'Here goes consent text from your website.';

  // choose only one variable
  var clientDecision = true; // if user agreed and provided consent
  var clientDecision = false; // if user refused to provide consent

  smartlook('consentIP', clientDecision ? consentText : false);
</script>

Identify user via API

User consented to being identified via the API.

<script>
  // in this variable insert your consent
  var consentText = 'Here goes consent text from your website.';

  // choose only one variable
  var clientDecision = true; // if user agreed and provided consent
  var clientDecision = false; // if user refused to provide consent

  smartlook('consentAPI', clientDecision ? consentText : false);
</script>

GDPR safe data

You can add attribute data-recording-gdpr-safe to any element that is safe and its numerical data (numbers, prices) are not sensitive.

<p data-recording-gdpr-safe>
  Tesla Model X price is $80,700.
</p>

Did this page help you?