Connecting Cludo to your cookie consent functionality

It is possible to add development to have the cookies set by Cludo connect with your general cookie consent formula.

For general information on cookies set by Cludo, read this article.

Technical Overview

At the moment Cludo stores session information in local storage that persists across end-user visits, we will invoke the callback function (canUserBeTracked). That function consists of custom JavaScript by yourself that will make a determination if the current end user can or can not be tracked.

Implementation instructions

Update cludoSettings to include the callback function (canUserBeTracked), which will be invoked whenever we are about to track a session and is expected to return true or false depending on the end user’s selected preferences stored or maintained by the customer.

Code example

Below you can find an example of a typical cludoSettings object with the addition of the canUserBeTracked callback method. You can use this callback to leverage your own criteria for whether or not the user can be tracked and will return true if yes or false if no.

<script type="text/javascript" src="https://customer.cludo.com/scripts/bundles/search-script.js"></script>
<script>
var CludoSearch;
(function () {
  var cludoSettings = {
    customerId: xx,
    engineId: xx,
    searchUrl: '/xxx/',
    ...
    canUserBeTracked: function() {
      // CUSTOM CONSENT DECISION CODE GOES HERE
      // Has user consented? return true
      // Has user declined? return false      
    }
    ...
  };
  CludoSearch = new Cludo(cludoSettings);
  CludoSearch.init();
})();
</script>

Technical breakdown

The canUserBeTracked callback can return true or false. Below, you can find a brief overview of the implications for returning each.

Return valueOutcome
trueReturning true (user can be tracked) allows CludoJS to set local storage data that enables CludoJS to track session data such that multiple searches, across multiple page views, will be part of the same session. Tracking of sessions allows MyCludo analytics to report on unique searches, whereas if we are unable to track sessions, we can’t necessarily differentiate unique searches.
falseReturning false prevents CludoJS from storing information about the session in local storage. Searches that occur across pages, tabs, or windows will not be associated with each other as one session.
Tags: