better-state-55387
06/13/2023, 11:49 AM<script id="growthbook-sdk" src="<https://cdn.jsdelivr.net/npm/@growthbook/growthbook/dist/bundles/index.min.js>" defer></script>
2. I have a custom html GB Implementation tag as in the documentation (I have only changed the clientKey. )
<script>
(function() {
// Wait for the SDK to load before starting GrowthBook
if (window.growthbook) {
startGrowthbook();
} else {
document.querySelector("#growthbook-sdk").addEventListener("load", startGrowthbook);
}
function startGrowthbook() {
if (!window.growthbook) return;
var gb = new growthbook.GrowthBook({
apiHost: "<https://cdn.growthbook.io>",
clientKey: "sdk-abcd1234",
// TODO: Add decryptionKey if using encryption
attributes: {
id: "u1234" // TODO: Read user/device id from a cookie/datalayer
},
trackingCallback: function(experiment, result) {
// TODO: track experiment impression
}
});
// TODO: Instrument DOM with AB test logic
}
})();
</script>
I have a few questions:
1. What to put for the id, if I want two kind of user identification? One is GA4's id, AND our own user_id. I found in the documentation that there is a way to add the GA4 id, however I'm unsure where it goes in the code, and not sure how two make 2 identification.
2. If we want to make the AB tests through the UI, in the Visual Editor feature (but with JS) is there anything else, I have to add to this code?
Thank you!