Bonjour
C'st un petit exemple théorique de GA compliant GDPR.
Très simple, mais est-ce que celà suffit pour Analytics ?
l'adresse ip n'y est pas.
Que va faire GA sans localisation ?
Résultat :
Merci beaucoup de vos réponses.
Amicalement.
C'st un petit exemple théorique de GA compliant GDPR.
Très simple, mais est-ce que celà suffit pour Analytics ?
l'adresse ip n'y est pas.
Que va faire GA sans localisation ?
Code:
D'abord :
/******* UUID.php ********/
<?php
function UUID_v4($anonid)
{
/**
* Fonction de hash
* hash("ripemd128", $anonid)
* avec $anonid
* en paramètre.
**/
/**
* Génère 32 caractères
* mais algorihtme
* correct ?
**/
$randomString = hash("ripemd128", $anonid);
$time_low = bin2hex(substr($randomString, 0, 4));
$time_mid = bin2hex(substr($randomString, 4, 2));
$time_hi_and_version = bin2hex(substr($randomString, 6, 2));
$clock_seq_hi_and_reserved = bin2hex(substr($randomString, 8, 2));
$node = bin2hex(substr($randomString, 10, 6));
/**
* Set the four most significant bits (bits 12 through 15) of the
* time_hi_and_version field to the 4-bit version number from
* Section 4.1.3.
* @see http://tools.ietf.org/html/rfc4122#section-4.1.3
*/
$time_hi_and_version = hexdec($time_hi_and_version);
$time_hi_and_version = $time_hi_and_version >> 4;
$time_hi_and_version = $time_hi_and_version | 0x4000;
/**
* Set the two most significant bits (bits 6 and 7) of the
* clock_seq_hi_and_reserved to zero and one, respectively.
*/
$clock_seq_hi_and_reserved = hexdec($clock_seq_hi_and_reserved);
$clock_seq_hi_and_reserved = $clock_seq_hi_and_reserved >> 2;
$clock_seq_hi_and_reserved = $clock_seq_hi_and_reserved | 0x8000;
return "'" . sprintf('%08s-%04s-%04x-%04x-%012s', $time_low, $time_mid, $time_hi_and_version, $clock_seq_hi_and_reserved, $node) . "'";
} // guid
?>
Ensuite :
/********** GA.php ********/
<?php
require("UUID.php");
$anonid = "ERVTEBBfggf:";
echo "`\nga('create', 'UA-XXXXX-Y', {
'storage': 'none',
'storeGac': false,
'clientId': " . UUID_v4($anonid) . "
});\n\n";
echo "ga('send', 'pageview');\n\n";
?>
Résultat :
Code:
ga('create', 'UA-XXXXX-Y', {
'storage': 'none',
'storeGac': false,
'clientId': '32303438-6366-4393-8e0d-623535396466'
});
ga('send', 'pageview');
Merci beaucoup de vos réponses.
Amicalement.