Cookieless: callback function

f you use the cookieless option, the loading of Google Analytics is modified to allow manipulation of the user identifier: the client_Id (GA4) or the clientId (UA).

You and your partners can use the Helper's native tail handler to initiate an asynchronous callback function when the identifier is ready.

The callback function will receive this object model as an argument:

{
    event: 'sdh_UUID_ready', //event name
    sdh_UUID: '1701630691.1681319441', //client_id or clientId
    sah_pa: '27421', //Partner Id
    sah_c: '71', //Config Id
    sah_consent: '0' //0 ou 1 : consent state for measurement purpose
}

The presence of an identifier and a consent value of 0 indicates that it is a cookieless identifier .

This identifier can be used for processing based on legitimate interest, but not processing based on consent.

UNDER NO REASON can it be stored in the user's terminal, in a cookie or in the local storage for example.

Here's how to set up your callback function:​

<script>
    var callback_function = function(data){
        //Your code here, example below :
        console.log(data);
        if (data.sdh_UUID) {
            console.log("le client_id est : " + data.sdh_UUID);
        }
        //End of demo code to be replaced
    }
    
    window.sd_gahq = window.sd_gahq || [];
    window.sd_gahq.push(callback_function);
</script>

​If the identifier is ready, your callback function will be executed immediately, and if not, it will be as soon as the identifier has been loaded.

Dernière mise à jour