- Connectez-vous au compte Kameleoon.
- Cliquez sur Admin > Projets.
- Cliquez sur Configuration sur la carte du site Web.

- Ajoutez le script ci-dessus dans le champ Script de sélection de variation.

Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Remplacez l’assignation de variation par défaut de Kameleoon pour fournir des variations cohérentes aux utilisateurs authentifiés sur tous les appareils en utilisant un identifiant utilisateur unique.
function (experiment)
{
var registeredVariationId;
var deviationRandom = experiment.obtainVariationAssignmentRandomNumber();
var total = 0.0;
for (var i = 0, l = experiment.variations.length; i < l; ++i)
{
total += experiment.variations[i].deviation;
if (deviationRandom <= total)
{
registeredVariationId = experiment.variations[i].id;
break;
}
}
return registeredVariationId != null ? registeredVariationId : "none";
}
function(experiment)
{
var memberId = window.member_id.toString(); //CODE to update with your variable that contains the unique identifier. It has to be available before calling the Kameleoon snippet
memberId = memberId + experiment.id.toString();
var hash = 0;
for (i = 0; i < memberId.length; ++i)
{
char = memberId.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash = hash & hash;
}
hash = (Math.abs(hash) * 9301 + 49297) % 233280;
var deviationRandom = hash / 233280;
var total = 0.0;
for (var i = 0, l = experiment.variations.length; i < l; ++i)
{
total += experiment.variations[i].deviation;
if (deviationRandom <= total)
{
chosenVariationId = experiment.variations[i].id;
break;
}
}
return registeredVariationId != null ? registeredVariationId : "none";
}


Cette page vous a-t-elle été utile ?