glamorous-keyboard-76926
11/13/2023, 10:46 PMgb.loadFeatures()
and instead manually implement experiment logic
});
}
})();
</script>
clientKey will be updated with my own, apiHost already matches my own
When referencing the user id for GA4, I apparently need to “nest the SDK instantiation inside your gtag callback function”. (second screenshot and code posted below):
gtag(‘get’, ‘G-XXXXXX’, ‘client_id’, function(cid) {
var gb = new growthbook.GrowthBook({
apiHost: “https://cdn.growthbook.io”,
clientKey: “sdk-abcd1234",
attributes: {
id: cid
},
// etc...
});
// TODO: Instrument DOM with AB test logic
});
So I am understanding this as I need to alter the first code based on the fact that I’m using GA4, and of course also switch out my measurement ID in addition to the clientKey. Is that correct? Could someone assist me on what the final code would look like if it’s just one snippet for my custom HTML tag in GTM?
Thanks a ton!
p.s. bonus question: What’s the ideal trigger to use? I have window loaded selected currently since that should in theory ensure GA4 fires first on initialization.rhythmic-agent-34208
11/15/2023, 12:18 AMglamorous-keyboard-76926
11/15/2023, 12:20 AMfresh-football-47124
glamorous-keyboard-76926
11/20/2023, 9:15 PMfresh-football-47124
glamorous-keyboard-76926
11/20/2023, 9:41 PMfresh-football-47124
glamorous-keyboard-76926
11/20/2023, 9:52 PMfresh-football-47124
glamorous-keyboard-76926
11/20/2023, 9:55 PMfresh-football-47124
glamorous-keyboard-76926
11/20/2023, 9:59 PMfresh-football-47124
glamorous-keyboard-76926
11/20/2023, 10:01 PMfresh-football-47124
glamorous-keyboard-76926
11/20/2023, 10:13 PMfresh-football-47124
glamorous-keyboard-76926
11/21/2023, 4:59 PMfresh-football-47124
glamorous-keyboard-76926
11/24/2023, 7:02 PM