Search code examples
google-analyticsgoogle-analytics-api

GTM dataLayer setting UUID only works after event / pageview is triggered


I'm setting

dataLayer.push({userId: 'someId'}) when User Login to my platform, and I have User-ID feature enabled,

Inside my Views, I have View that's only showing Users with set userId, I notice that user won't show up until I either trigger pageView or some custom event after setting that userId

Is there a workaround for it?


Solution

  • You can send the pageview after you have obtained the value of the userId, for example to DOM ready.