使用 Azure Application Insights 了解客户对应用程序的使用情况Use Azure Application Insights to understand how customers are using your application

Azure Application Insights 收集使用情况信息,帮助了解用户与应用程序的交互情况。Azure Application Insights collects usage information to help you understand how your users interact with your application. 本教程详细介绍可用于分析此信息的不同资源。This tutorial walks you through the different resources that are available to analyze this information. 可以了解如何执行以下操作:You will learn how to:

  • 分析有关访问应用程序的用户的详细信息Analyze details about users accessing your application
  • 使用会话信息分析客户对应用程序的使用情况Use session information to analyze how customers use your application
  • 定义漏斗,以便比较所需用户活动及其实际活动Define funnels that let you compare your desired user activity to their actual activity
  • 创建用于将可视化效果和查询整合到单个文档中的工作簿Create a workbook to consolidate visualizations and queries into a single document
  • 对类似用户分组,以便放在一起分析Group similar users to analyze them together
  • 了解哪些用户会回到应用程序Learn which users are returning to your application
  • 检查用户如何浏览应用程序Inspect how users navigate through your application

先决条件Prerequisites

完成本教程:To complete this tutorial:

登录 AzureLog in to Azure

通过 https://portal.azure.cn 登录到 Azure 门户。Log in to the Azure portal at https://portal.azure.cn.

获取有关用户的信息Get information about your users

借助“用户” 面板,可使用各种方式了解有关用户的重要详细信息。The Users panel allows you to understand important details about your users in a variety of ways. 此面板可用于了解用户的连接位置、其客户端的详细信息及其所访问的应用程序区域等信息。You can use this panel to understand such information as where your users are connecting from, details of their client, and what areas of your application they're accessing.

  1. 选择“Application Insights”,然后选择订阅 。Select Application Insights and then select your subscription.

  2. 在菜单中选择“用户” 。Select Users in the menu.

  3. 默认视图显示过去 24 小时内连接到应用程序的唯一用户的数量。The default view shows the number of unique users that have connected to your application over the past 24 hours. 可更改时间范围并设置各种其他条件来筛选此信息。You can change the time window and set various other criteria to filter this information.

    查询生成器

  4. 单击“期间” 下拉列表,将时间范围更改为 7 天。Click the During dropdown and change the time window to 7 days. 此操作可增加面板中不同图表内包含的数据。This increases the data included in the different charts in the panel.

    更改时间范围

  5. 单击“拆分方式” 下拉列表,向图表添加按用户属性分类的细分。Click the Split by dropdown to add a breakdown by a user property to the graph. 选择“国家或地区” 。Select Country or region. 该图表包含的数据相同,但可查看每个国家/地区的用户数的细分。The graph includes the same data but allows you to view a breakdown of the number of users for each country.

    “国家或地区”图表

  6. 将光标放在图表中的不同条形图上进行查看,请注意,每个国家/地区的计数仅反映由该条形图表示的时间范围。Position the cursor over different bars in the chart and note that the count for each country reflects only the time window represented by that bar.

  7. 查看右侧的 Insights 列,该列对用户数据执行分析。Have a look at the Insights column at the right that perform analysis on your user data. 此列提供的信息包括:一段时间内的唯一会话的数量,以及具有构成用户数据有效值的常见属性的记录This provides information such as the number of unique sessions over the time period and records with common properties that make up significant of the user data

    Insights 列

分析用户会话Analyze user sessions

“会话” 面板与“用户” 面板类似。The Sessions panel is similar to the Users panel. 其中“用户” 面板可帮助了解有关访问应用程序的用户的详细信息,“会话” 面板可帮助了解这些用户对应用程序的使用情况。Where Users helps you understand details about the users accessing your application, Sessions helps you understand how those users used your application.

  1. 在菜单中选择“会话” 。Select Sessions in the menu.

  2. 查看图表,请注意,用于筛选和细分数据的选项与“用户” 面板中的相关选项相同。Have a look at the graph and note that you have the same options to filter and break down the data as in the Users panel.

    会话查询生成器

  3. 右侧的“这些会话的示例” 面板列出包含大量事件的会话。The Sample of these sessions pane on the right lists sessions that include a large number of events. 这些会话是需要分析的重点会话。These are interesting sessions to analyze.

    这些会话的示例

  4. 单击其中一个会话,查看其“会话时间线” ,其中显示会话中的每个操作。Click on one of the sessions to view its Session Timeline, which shows every action in the sessions. 此操作可帮助确定具有大量异常的会话等信息。This can help you identify information such as the sessions with a large number of exceptions.

    会话时间线

对类似用户进行分组Group together similar users

队列是指一组按类似特征进行分组的用户。A Cohort is a set of users groupd on similar characteristics. 可使用队列筛选其他面板中的数据,以便分析特定用户组。You can use cohorts to filter data in other panels allowing you to analyze particular groups of users. 例如,可能只想分析完成了购买的用户。For example, you might want to analyze only users who completed a purchase.

  1. 在菜单中选择“队列” 。Select Cohorts in the menu.

  2. 单击“新建” ,新建队列。Click New to create a new cohort.

  3. 选择“使用者” 下拉列表,然后选择一个操作。Select the Who used dropdown and select an action. 仅会包含在报告时间范围内执行此操作的用户。Only users who performed this action within the time window of the report will be included.

    执行指定操作的用户队列

  4. 在菜单中选择“用户” 。Select Users in the menu.

  5. 在“显示” 下拉列表中,选择刚才创建的队列。In the Show dropdown, select the cohort you just created. 图表中的数据限制为这些用户。The data for the graph is limited to those users.

    用户工具中的队列

比较所需活动与实际活动Compare desired activity to reality

尽管前几个面板侧重于应用程序用户执行的操作,但“漏斗” 面板侧重于希望用户执行的操作。While the previous panels are focused on what users of your application did, Funnels focus on what you want users to do. 漏斗表示应用程序中的一组步骤和执行这些步骤的用户所占的百分比。A funnel represents a set of steps in your application and the percentage of users who move between steps. 例如,可创建用于度量通过搜索产品连接到应用程序的用户所占百分比的漏斗。For example, you could create a funnel that measures the percentage of users who connect to your application who search product. 随后可查看将该产品添加到购物车中的用户所占的百分比,以及完成购买的用户所占的百分比。You can then see the percentage of users who add that product to a shopping cart, and then the percentage of those who complete a purchase.

  1. 在菜单中选择“漏斗” ,然后单击“新建” 。Select Funnels in the menu and then click New.

  2. 键入“漏斗名称” 。Type in a Funnel Name.

  3. 通过为每个步骤选择一个操作,创建至少具有两个步骤的漏斗。Create a funnel with at least two steps by selecting an action for each step. 使用 Application Insights 收集的使用情况数据生成操作列表。The list of actions is built from usage data collected by Application Insights.

  4. 单击“保存” 来保存漏斗,然后查看其结果。Click Save to save the funnel and then view its results. 漏斗右侧的窗口显示第一个活动之前和最后一个活动之后的最常见事件,帮助了解特定顺序下的用户倾向。The window to the right of the funnel shows the most common events before the first activity and after the last activity to help you understand user tendencies around the particular sequence.

了解哪些客户会返回Learn which customers return

保留期可帮助了解哪些用户会回到应用程序。Retention helps you understand which users are coming back to your application.

  1. 在菜单中选择“保留期” 。Select Retention in the menu.

  2. 默认情况下,经过分析的信息包含执行任何操作后,再返回应用程序执行操作的用户。By default, the analyzed information includes users who performed any action and then returned to perform any action. 例如,可将此筛选器更改为仅包含完成购买后返回应用程序的用户。You can change this filter to any include, for example, only those users who returned after completing a purchase.

  3. 针对不同的持续时间以图表和表格的形式显示匹配标准的返回用户。The returning users that match the criteria are shown in graphical and table form for different time durations. 典型模式为返回用户的数量在一段时间内平稳下降。The typical pattern is for a gradual drop in returning users over time. 从一个时段到下一个时段出现突然下降可能会引起关注。A sudden drop from one time period to the next might raise a concern.

分析用户导航Analyze user navigation

用户流可视化用户在应用程序的页面和功能之间导航的情况。A User flow visualizes how users navigate between the pages and features of your application. 这有助于回答诸如用户通常从特定页面的哪个位置移动、用户通常如何退出应用程序以及是否存在任何定期重复的操作等问题。This helps you answer questions such as where users typically move from a particular page, how they typically exit your application, and if there are any actions that are regularly repeated.

  1. 在菜单中选择“用户流” 。Select User flows in the menu.

  2. 单击“新建” 来新建用户流,然后单击“编辑” 来编辑其详细信息。Click New to create a new user flow and then click Edit to edit its details.

  3. 将“时间范围” 增加为 7 天,然后选择初始事件。Increase the Time Range to 7 days and then select an initial event. 用户流将跟踪从该事件开始的用户会话。The flow will track user sessions that start with that event.

  4. 此时会显示用户流,可查看不同用户路径及其会话计数。The user flow is displayed, and you can see the different user paths and their session counts. 蓝线指示用户在当前操作后执行的操作。Blue lines indicate an action that the user performed after the current action. 红线指示用户会话结束。A red line indicates the end of the user session.

  5. 若要从用户流中删除事件,请单击操作角落中的 x,然后单击“创建图形” 。To remove an event from the flow, click the x in the corner of the action and then click Create Graph. 图表会重新绘制,并删除该事件的所有实例。The graph is redrawn with any instances of that event removed. 单击“编辑” 查看现在已添加到“已排除的事件” 中的事件。Click Edit to see that the event is now added to Excluded events.

整合使用情况数据Consolidate usage data

工作簿可将数据可视化效果、Analytics 查询和文本合并到交互式文档中。Workbooks combine data visualizations, Analytics queries, and text into interactive documents. 工作簿可用于对常见使用情况信息分组、整合来自特定事件的信息或向团队报告应用程序使用情况。You can use workbooks to group together common usage information, consolidate information from a particular incident, or report back to your team on your application's usage.

  1. 在菜单中选择“工作簿” 。Select Workbooks in the menu.

  2. 单击“新建” 以新建工作簿。Click New to create a new workbook.

  3. 我们已经提供一个包含前一天的所有使用情况数据(显示为条形图)的查询。A query is already provided that includes all usage data in the last day displayed as a bar chart. 用户可使用此查询、手动编辑此查询,或单击“示例查询” 来从其他有用查询中进行选择。You can use this query, manually edit it, or click Sample queries to select from other useful queries.

  4. 单击“完成编辑” 。Click Done editing.

  5. 单击顶部窗格中的“编辑” 来编辑工作簿顶部的文本,Click Edit in the top pane to edit the text at the top of the workbook. 其采用 markdown 格式。This is formatted using markdown.

  6. 单击“添加用户” ,添加包含用户信息的图表。Click Add users to add a graph with user information. 编辑图表的详细信息(如果需要),然后单击“完成编辑” 将其保存。Edit the details of the graph if you want and then click Done editing to save it.

后续步骤Next steps

现在,你已学会如何分析用户,请继续完成下一教程,学习如何创建将此信息与其他有关应用程序的有用数据合并的自定义仪表板。Now that you've learned how to analyze your users, advance to the next tutorial to learn how to create custom dashboards that combine this information with other useful data about your application.