The portal of Application Insights lets you investigate telemetry data in several ways. One of the blades is called ‘Sessions’ and as the name suggests it let you investigate user sessions. This allows you to analyze individual user sessions. For example, you can see which pages a user visited and how the user interacted with different components on your website. The different filters allow you to discover popular user flows. For example, what did users do before a certain event or pageview and what did they do afterward. All can be useful information to optimize and improve your website.

The way Application Insights recognizes returning users is somehow similar like for collecting telemetry data for user sessions. The first time a new user is visiting your website a unique identifier is generated and stored in a cookie called ai_user . All telemetry data that is tracked for this user is enriched with this unique identifier. The user cookie expires in 365 days and never retires. The value of the cookie contains two values separated by a pipe: URHeT|2017-11-18T14:27:58.369Z.

The first value is the unique user id and the second value is the date time the cookie was created. In the EU the cookie law prevents websites to unasked create cookies that track user behavior. A cookie warning must be displayed and accepted by the visitor before cookies can be created. To prevent that cookies are created you can set the isCookieUseDisabled setting to true. Note, that setting this setting to true cookies are not created and the user id and session id is regenerated every time a page is refreshed or loaded.

Below an example of a page view telemetry data that is sent to Application Insights. In this JSON the session id, isFirst, and user id property is set.