The website I am managing exposes the user’s unique ID in a number of different places depending upon the journey they take. The user ID may be retrieved from the data layer a referring URL parameter or a page parameter.
In GTM I am retrieving the user ID and storing in 5 different variables, only 1 of which will have the actual ID – the others will be NULL values.
If I want to send the actual user ID to GA4 using the user_id
event parameter how can I select the value that may be in 1 of 5 variables without having the correct value overwritten by NULLs?
I can imagine a JS script might do it, but I don’t know where that would live and be executed.