You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a requirement for users of our site to be able to toggle non-essential cookies on / off for GDPR purposes. I have been looking at how to achieve this with Application Insights for a couple of days now.
I have been using appInsights.getCookieMgr().setEnabled(false/true) to try and solve this. However it seems there could be some issues, or perhaps I'm misunderstanding something! I'm using Angular for development.
It seems that setEnabled(false/true) does not always delete/re-create the cookies. I'm thinking that perhaps instead it blocks/un-blocks the cookies being used - is this correct? If so, this might be an ok solution. However, if Application Insights is initiated with disableCookiesUsage: true, then setEnabled(true), will never create any cookies. I did read in an issue (#1585) and associated PR (#1628), that we should use appInsights.context.user.update(), this does create the ai_user cookie, but ai_session does not get created for me, is there a separate way to do this?
I did think the easiest way to achieve the requirement might be to simply reinitialise Application Insights on user toggle, changing disableCookiesUsage: false/true accordingly. However I'm concerned this could cause unwanted side effects and/or lots of uneccerserry noise in the logs if a user toggles multiple times.
I'm not sure where to go next on this, or if there's a really simple way to achieve what I need that I'm missing, any help with this flow would be really appreciated.
The text was updated successfully, but these errors were encountered:
Follow up on this. Our policy page where the cookie toggle exists opens in the new browser tab, when setting setEnabled(true) in this tab, then the ai_user cookie gets created, but ai_session cookie does not. To work round this I needed to send a message from the cookie policy tab to the original tab where AI was initialised to trigger setEnabled(true) and the ai_session cookie will now appear (after around 60 seconds).
I do wonder if the ai_session not being created is a bug, but have found a work around to what was causing much of the confusion above, so am closing this.
I have a requirement for users of our site to be able to toggle non-essential cookies on / off for GDPR purposes. I have been looking at how to achieve this with Application Insights for a couple of days now.
I have been using
appInsights.getCookieMgr().setEnabled(false/true)
to try and solve this. However it seems there could be some issues, or perhaps I'm misunderstanding something! I'm using Angular for development.It seems that
setEnabled(false/true)
does not always delete/re-create the cookies. I'm thinking that perhaps instead it blocks/un-blocks the cookies being used - is this correct? If so, this might be an ok solution. However, if Application Insights is initiated withdisableCookiesUsage: true
, thensetEnabled(true)
, will never create any cookies. I did read in an issue (#1585) and associated PR (#1628), that we should useappInsights.context.user.update()
, this does create theai_user
cookie, butai_session
does not get created for me, is there a separate way to do this?I did think the easiest way to achieve the requirement might be to simply reinitialise Application Insights on user toggle, changing
disableCookiesUsage: false/true
accordingly. However I'm concerned this could cause unwanted side effects and/or lots of uneccerserry noise in the logs if a user toggles multiple times.I'm not sure where to go next on this, or if there's a really simple way to achieve what I need that I'm missing, any help with this flow would be really appreciated.
The text was updated successfully, but these errors were encountered: