Smartlook
Web
Getting startedIdentify visitorGDPRSensitive data protectionCustom eventsCustom event propertiesCustom click propertiesCustom navigation eventRecording APIError logging
SDK Installation
SDK Conceptual
SDK API reference
SDK Cookbooks
SDK Integrations
REST API (beta)

GDPR

Record user information about EU visitors.

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

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.

user consent

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:

  1. true if user agreed and provided consent
  2. false if user refused to provide consent
  3. null if user was not asked for consent yet

Form inputs

User consented to have their form inputs recorded.

<script>
// in this variable inser 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 inser 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 inser 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 atribute 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>