Why might my trackingCallback be failing to be cal...
# ask-questions
f
Why might my trackingCallback be failing to be called?
Ah, the answer is that I needed to set
id
in user attributes, to give growthbook something to hash to add them to experiments
I was expecting
anonymous_id
to be the property I should be setting, but IG growthbook automatically detects whether the ID is anonymous or not?
f
Glad you got it sorted. We often default to adding two randomization units (id and anon id) - but not every product has them
f
oh? how would I add anon id?
I'm working w/ GA4, so I'm using
_ga
as the id
f
Hey @faint-portugal-50749 _ga is correct. When you setup a BigQuery integration in GB then you set different identifiertypes like anonymous_id Anonymous visitor id user_id Logged-in user id and then you can also join them so they become one group. Here is an example:
Just be sure that _ga is available when GB loads… that can be a problem a lot of times that GB loads before GA and there for no _ga is set for new users (Cookie Consent Policies). You can consider a polling logic in your code that polls for a _ga cookie so you can set the attribute later.
f
so ga.setAttributes({ id: Cookies.getCookie(“_ga”) }) should be correct (with the polling wrapped around it like you say
i get the idea of the anonymous_id and user_id but i don’t get where they actually come from in BigQuery
f
When you connect GA4 with BigQuery your GA data is a dataset in BQ there you will have a collumn with anonymous_id
Also when you setAttributes during or after the pageload you should do a setRenderer next so GB will check all targetting attributes for all experiments/featureflags.
👀 1
And when you do setAttributes you should do them all not for only one attribute.
Like this. @faint-portugal-50749
f
How do you grab those attributes? Are you manually constructing them or grabbing them from GA4 somehow?
f
@faint-portugal-50749 we construct them ourselves through our javascript toolkit that we load combined with the GB javascript SDK. We don’t pull stuff from the datalayer as that information is not fast enough available…. the slower you set you targetting attributes the more risk you have with page flashing.
👍 1
f
I see
Is the advantage to adding more detail that you can see the experiment results according to different dimensions? "option a tested well amongst mobile users but not desktop users", etc?
f
It’s all about getting a proper dataset of your experiment… i.e. if you target only smartphone visitor you don’t want to have desktop visitors in there as you need to filter them out and filtering out data can increase the risk of SRM fails.
👍 1
Also it makes calculations for experiment duration more complicated.
f
hmmm
gtk
f
So yeah if you want to run proper high quality experiments with reliable data and outcomes it’s worth investing on proper targetting techniques
👍 1
f
I'm quite green to all of this, is there any material out there to learn a bit more about it?
f
Which in case of emergency is something we can help with…
Yeah there are offcourse online courses… but I didn’t take them so I couldn’t recommend one.
most courses are tailored to setting up experimentation programs etc. not necessarily setting up experiments correctly…
💜 1