I want to display the UserId on the website, so users can communicate it to us whenever they encounter a problem. However, in code, appInsights.context is undefined. How can I access this?
window.appInsights = appInsights;
appInsights.trackPageView();
console.log(appInsights.context);
is logged as undefined. However, I can access it in the developer console when I run the application. It seems like the context is being removed/not added yet.
I believe this is because the appInsights context is not necessarily created right away?
you may need to do this work "asynchronously" by adding events to the ai queue: