Consent Management

Info

Available since Jitsu v2.8.0 and npm packages v1.9.7

Jitsu JavaScript library supports multiple Privacy Settings to comply with GDPR and other privacy regulations.

There are many Consent Management Platforms (CMPs) available on the market, most of which provide a JavaScript API to access user consent settings after the user interacts with the consent banner. A common approach to integrate user consent with the Jitsu library is to configure Jitsu according to these settings by implementing a JavaScript callback provided by the CMP API.

For example:

// Change Jitsu configuration according to user consent settings.
SomeCMP.OnConsentChanged(function(e) {
  const consent = e.detail.includes('C0002');
  jitsu.configure({
    privacy: {
      dontSend: !consent,
      ipPolicy:  consent ? "keep" :"stripLastOctet",
      disableUserIds: !consent,
      consentCategories: e.detail.reduce((acc, category) => {
        acc[category] = true;
        return acc;
      }, {})
    }
  });
})

There are two approaches to tracking users before they provide consent:

  1. Do not track any users data at all until they provide consent.
  2. Track users with limited data collection before they provide consent.
Warning

Both approaches must be implemented in conjunction with selected CMP SDKs to ensure proper user consent collection.

Without this integration, the Jitsu library will not be able to detect the user’s consent status and may remain in the pre-consent state.

Do not track

In such case Jitsu Library must be initialized in dont-send mode.

For example:

<script async src="https://your-jitsu-domain.com/p.js" data-privacy-dont-send="true" ></script>

In this mode Jitsu doesn't store anything in cookies and doesn't send events to Jitsu servers.

When user provides consent, Jitsu library settings must be adjusted with proper privacy settings.

// Change Jitsu configuration according to user consent settings.
SomeCMP.OnConsentChanged(function(e) {
  const consent = e.detail.includes('C0002');
  jitsu.configure({
    privacy: {
      dontSend: !consent,
      consentCategories: e.detail.reduce((acc, category) => {
        acc[category] = true;
        return acc;
      }, {})
    }
  });
})

Track with limited data collection

It is possible to track users with limited data collection before they provide consent.

In this case, Jitsu library must be initialized with privacy settings that disable collection of Personally Identifiable Information.

Info

In this mode identify and group calls will have no effect.

For example:

<script async src="https://your-jitsu-domain.com/p.js" 
        data-privacy-disable-user-ids="true"
        data-privacy-ip-policy="stripLastOctet">
</script>

When user provides consent, Jitsu library settings must be adjusted with proper privacy settings.

// Change Jitsu configuration according to user consent settings.
SomeCMP.OnConsentChanged(function(e) {
  const consent = e.detail.includes('C0002');
  jitsu.configure({
    privacy: {
      disableUserIds: !consent,
      ipPolicy: consent ? "keep" :"stripLastOctet",
      consentCategories: e.detail.reduce((acc, category) => {
        acc[category] = true;
        return acc;
      }, {})
    }
  });
})

OneTrust example

Here is an example of how to configure Jitsu library with OneTrust Consent Management for Web.

Setting up Jitsu Library with limited tracking

<script async src="https://your-jitsu-domain.com/p.js" 
        data-privacy-disable-user-ids="true" 
        data-privacy-ip-policy="stripLastOctet">
</script>

Setting up OneTrust script with adjusted callback

<!-- OneTrust Cookies Consent Notice start for example.com -->
<script
        src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js"
        type="text/javascript"
        charset="UTF-8"
        data-domain-script="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" >
</script>
<script type="text/javascript">
        function OptanonWrapper() {
          OneTrust.OnConsentChanged(function(e) {
            const consent = e.detail.includes('C0002');
            jitsu.configure({
              privacy: {
                disableUserIds: !consent,
                ipPolicy: consent ? "keep" :"stripLastOctet",
                consentCategories: e.detail.reduce((acc, category) => {
                  acc[category] = true;
                  return acc;
                }, {})
              }
            });
          })
        }
</script>
<!-- OneTrust Cookies Consent Notice end for example.com -->