Analytics-related REST APIs

The AnswerHub platform has several built-in analytics functions. This section will give you some essential information about using the REST API with AnswerHub analytics.

📘

Notes on analytics:

  • Analytics services accept several request parameters you can used to tailor the type of the retrieved subset of the captured analytics data by the AnswerHub server.
  • Some parameters are valid for all analytics services, while others are specific to each service.

Documentation Related to Analytics

Analytics Parameters

Common Parameters: Sampling Period and Rate

The parameters valid for all analytics methods include the time period for which you request analytics data, in addition to the sampling and aggregation rate. You can explicitly specify the time period with a start time and date, and an end time and date.

📘

NOTE:

If you do not explicitly specify the end time and date, the system uses the current time and date.

You can also specify the time period with a normative value, such as MONTH (This value would provide the requested data for the past month).

📘

NOTE:

When you specify the time period with a normative value, the end time is, by default, the current time and date. However, if you need to, you can also set this value.

The table below summarizes the request parameters common to all simple analytics requests:

ParameterValuesExampleDescription
periodPeriodMONTHThe length of time to retrieve data from.
ratePeriodHOURThe sampling and aggregation rate for the retrieved data (bin size).
toDateTimestamp3/1/10The end date to retrieve data until (overrides period).
fromDateTimestamp1/1/10The initial date to retrieve data from (overrides period).

We define the following values for the period parameter:

ValuesDescription
MONTHThe last month or a monthly sampling and aggregation rate.
WEEKThe last week or a weekly sampling and aggregation rate.
DAYThe most recent day or a daily sampling and aggregation rate.
HOURThe most recent hour or an hourly sampling and aggregation rate.

Common Parameters: Type of Statistical Data

You can retrieve analytics information in two forms: as a time-series of the aggregate events (the activity time series) or as a relative frequency histogram.

The table below summarizes the request parameters used to control the type of statistical data to retrieve:

ParameterValues
activityBoolean
histogramBoolean

Advanced Analytics Parameters

Advanced analytics parameters are essentially the same as those used for simple analytics. However, they further allow you to specify the subset of AnalyticsProvider for which you want data retrieved.

A key uniquely identifies each AnalyticsProvider. Use the keys parameter to specify, in a comma-separated list, the subset of AnalyticsProviders to consider. If you do not specify the keys parameter, the system retrieves information from all of the currently installed AnalyticsProviders.

ParameterValues
keysString[,String]

Analytics Data Models

ActionAnalytics Field Summary

Field NameTypeExample(s)Description
typeStringUserJoinsActionThe name for the type of the action performed.
verbStringjoinedThe verb keyword of the action.
countInteger (64 bits)12345The number of action events during the requested period.
sinceTimestamp1329146113000The starting date of the requested information (for example: the date of the first sampled action event). The system supplies this date by the from request parameter or from the period parameter, if used.
activityTimestamp[40,90,120, ....]The time-series for action events.
binTimestamp60000 (1 min)The bin size for histogram (in milliseconds).
histogramInteger64[134,573,....]The histogram of action occurrences for the requested analytics.

AnalyticsData Field Summary

Field NameTypeExample(s)Description
keyStringadv-active-questionsThe key or unique identifier for the AnalyticsProvider.
nameStringActive QuestionsThe human readable name of the AnalyticsProvider.
activityTimestamp[][40,90,120, ....]The time-series produced by the AnalyticsProvider (usually a series of actions of a specific type).

AdvancedAnalytics Field Summary

We define the following values for the rate parameter:

ValuesDescription
monthlyThe last month or a monthly sampling and aggregation rate.
weeklyThe last week or a weekly sampling and aggregation rate.
dailyThe most recent day or a daily sampling and aggregation rate.
hourlyThe most recent hour or an hourly sampling and aggregation rate.
Field NameTypeExample(s)Description
analyticsAnalyticsData[][{}, ..]A list of AnalyticsData for each registered and requested AnalyticsProvider.