The StatisticsCollector policy (also referred to as Custom Analytics) allows you to collect statistical data for messages processed in a flow, such as product ID, price, REST action, client and target URL, and message length (predefined flow variables as well as custom variables). The data is then provided to the analytics server, which analyzes the statistics and generates reports. You can view the reports through Apigee Analytics services.
In Apigee, you can attach a Statistics Collector policy to the response path in your APIs, where you can capture and publish a range of statistics to the analytics server.
For more information on how to analyze your data using Apigee analytics, see Analyze API message content using custom analytics.
Configuring a Statistics Collector policy
Configure the Statistics Collector policy using the following elements.
| Field Name | Description |
|---|---|
| name | Custom name provided for the referenced variable. In the example below, the referenced variable is product.id. |
| ref | Flow variable that can be a predefined variable or a variable defined in the XML payload of the Extract Variables policy. See Extract message content using ExtractVariables. |
| type | Valid values: string/integer/float/long/boolean/double If provided, overrides the existing datatype of ref. Note that the type can be left empty only if ref is a predefined variable or the type is declared in the XML payload of the Extract Variables policy. |
Note that in the example below, if defaultval is not provided, the variable is typically assigned during the message flow.