Skip to content

Commit 706cfce

Browse files
committed
Editing pass
1 parent 0a1525a commit 706cfce

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

articles/search/search-traffic-analytics.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ ms.date: 03/18/2020
1414

1515
# Collect telemetry data for search traffic analytics
1616

17-
Search traffic analytics is a pattern for implementing a feedback loop for your Azure Cognitive Search service. The objective is to collect telemetry on user-initiated click events and keyboard inputs. Using this information, you can determine the effectiveness of your search solution, including popular search terms, clickthrough rate, and which query inputs yield zero results.
17+
Search traffic analytics is a pattern for collecting telemetry about user interactions with your Azure Cognitive Search application, such as user-initiated click events and keyboard inputs. Using this information, you can determine the effectiveness of your search solution, including popular search terms, clickthrough rate, and which query inputs yield zero results.
1818

19-
This pattern takes a dependency on [Application Insights](https://docs.microsoft.com/azure/azure-monitor/app/app-insights-overview) (a feature of [Azure Monitor](https://docs.microsoft.com/azure/azure-monitor/)) to collect user data. You will also need to add instrumentation to your client code, as described in this article. Finally, you will need a reporting mechanism to analyze the data. We recommend Power BI but you can use the Application Dashboard or any tool that connects to Application Insights.
19+
This pattern takes a dependency on [Application Insights](https://docs.microsoft.com/azure/azure-monitor/app/app-insights-overview) (a feature of [Azure Monitor](https://docs.microsoft.com/azure/azure-monitor/)) to collect user data. It requires that you add instrumentation to your client code, as described in this article. Finally, you will need a reporting mechanism to analyze the data. We recommend Power BI but you can use the Application Dashboard or any tool that connects to Application Insights.
2020

2121
> [!NOTE]
22-
> The pattern described in this article is for advanced scenarios and clickstream data generated by your client. Alternatively, you can report on log information generated by your search service. For more information, see [Collect and analyze log data](search-monitor-logs.md).
22+
> The pattern described in this article is for advanced scenarios and clickstream data generated by code you add to your client. In contrast, service logs are easy to set up and can be done in the portal. For more information, see [Collect and analyze log data](search-monitor-logs.md).
2323
2424
## Identify relevant search data
2525

@@ -41,9 +41,9 @@ In the [portal](https://portal.azure.com) page for your Azure Cognitive Search s
4141

4242
Select an existing Application Insights resource or [create one](https://docs.microsoft.com/azure/azure-monitor/app/create-new-resource) if you don't have one already.
4343

44-
For various IDEs and languages, you can follow [instructions for adding Application Insights](https://docs.microsoft.com/azure/azure-monitor/app/platforms) to your code.
44+
To register your app with Application Insights, you can follow [instructions for supported languages and platforms](https://docs.microsoft.com/azure/azure-monitor/app/platforms). Registration is simply adding the instrumentation key from Application Insights to your code, which sets up the association. You can find the key in the portal, or from the Search Traffic Analytics page when you select an existing resource.
4545

46-
You'll need the instrumentation key for creating the telemetry client for your application, which you can find it in the portal, or from the Search Traffic Analytics page when you select an existing resource.
46+
For some Visual Studio project types, you can create an Application Insights resource and register your apps in just a few clicks.
4747

4848
1. For Visual Studio and ASP.NET development, open your solution and select **Project** > **Add Application Insights Telemetry**.
4949

@@ -67,7 +67,7 @@ On the client, you might have additional code that manipulates query inputs, add
6767

6868
**Use C#**
6969

70-
Depending on the approach used to register your app, the **InstrumentationKey** is in appsettings.json if your project is ASP.NET. Refer back to the registration instructions if you are unsure of the key location.
70+
For C#, the **InstrumentationKey** is found in your application configuration, such as appsettings.json if your project is ASP.NET. Refer back to the registration instructions if you are unsure of the key location.
7171

7272
```csharp
7373
private static TelemetryClient _telemetryClient;
@@ -92,21 +92,22 @@ window.appInsights=appInsights;
9292

9393
### Step 2: Request a Search ID for correlation
9494

95-
To correlate search requests with clicks, it's necessary to have a correlation ID that relates these two distinct events. Azure Cognitive Search provides you with a Search ID when you request it with a header.
95+
To correlate search requests with clicks, it's necessary to have a correlation ID that relates these two distinct events. Azure Cognitive Search provides you with a search ID when you request it with an HTTP header.
9696

97-
Having the search ID allows correlation of the metrics emitted by Azure Cognitive Search for the actual search request, with the custom metrics you are logging in Application Insights.
97+
Having the search ID allows correlation of the metrics emitted by Azure Cognitive Search for the request itself, with the custom metrics you are logging in Application Insights.
9898

9999
**Use C#**
100100

101101
```csharp
102102
// This sample uses the .NET SDK https://www.nuget.org/packages/Microsoft.Azure.Search
103103
104104
var client = new SearchIndexClient(<SearchServiceName>, <IndexName>, new SearchCredentials(<QueryKey>)
105+
106+
// Use HTTP headers so that you can get the search ID from the response
105107
var headers = new Dictionary<string, List<string>>() { { "x-ms-azs-return-searchid", new List<string>() { "true" } } };
106108
var response = await client.Documents.SearchWithHttpMessagesAsync(searchText: searchText, searchParameters: parameters, customHeaders: headers);
107-
IEnumerable<string> headerValues;
108109
string searchId = string.Empty;
109-
if (response.Response.Headers.TryGetValues("x-ms-azs-searchid", out headerValues)){
110+
if (response.Response.Headers.TryGetValues("x-ms-azs-searchid", out IEnumerable<string> headerValues)){
110111
searchId = headerValues.FirstOrDefault();
111112
}
112113
```
@@ -222,7 +223,7 @@ Metrics included the following items:
222223
+ Search volume and most popular term-document pairs: terms that result in the same document clicked, ordered by clicks.
223224
+ Searches without clicks: terms for top queries that register no clicks
224225

225-
The following screenshot shows the built-in reports and charts for analyzing search traffic analytics.
226+
The following screenshot shows what a built-in report might look like if you have used all of the schema elements.
226227

227228
![Power BI dashboard for Azure Cognitive Search](./media/search-traffic-analytics/azuresearch-powerbi-dashboard.png "Power BI dashboard for Azure Cognitive Search")
228229

0 commit comments

Comments
 (0)