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:

Parameter

Values

Example

Description

period

Period

MONTH

The length of time to retrieve data from.

rate

Period

HOUR

The sampling and aggregation rate for the retrieved data (bin size).

toDate

Timestamp

3/1/10

The end date to retrieve data until (overrides period).

fromDate

Timestamp

1/1/10

The initial date to retrieve data from (overrides period).

We define the following values for the period parameter:

Values

Description

MONTH

The last month or a monthly sampling and aggregation rate.

WEEK

The last week or a weekly sampling and aggregation rate.

DAY

The most recent day or a daily sampling and aggregation rate.

HOUR

The 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:

Parameter

Values

activity

Boolean

histogram

Boolean

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.

Parameter

Values

keys

String[,String]

Analytics Data Models

ActionAnalytics Field Summary

Field Name

Type

Example(s)

Description

type

String

UserJoinsAction

The name for the type of the action performed.

verb

String

joined

The verb keyword of the action.

count

Integer (64 bits)

12345

The number of action events during the requested period.

since

Timestamp

1329146113000

The 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.

activity

Timestamp

[40,90,120, ....]

The time-series for action events.

bin

Timestamp

60000 (1 min)

The bin size for histogram (in milliseconds).

histogram

Integer64

[134,573,....]

The histogram of action occurrences for the requested analytics.

AnalyticsData Field Summary

Field Name

Type

Example(s)

Description

key

String

adv-active-questions

The key or unique identifier for the AnalyticsProvider.

name

String

Active Questions

The human readable name of the AnalyticsProvider.

activity

Timestamp[]

[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:

Values

Description

monthly

The last month or a monthly sampling and aggregation rate.

weekly

The last week or a weekly sampling and aggregation rate.

daily

The most recent day or a daily sampling and aggregation rate.

hourly

The most recent hour or an hourly sampling and aggregation rate.

Field Name

Type

Example(s)

Description

analytics

AnalyticsData[]

[{}, ..]

A list of AnalyticsData for each registered and requested AnalyticsProvider.