Viewrium Docs
Objects

The Usage object

Viewer and AR event counts over a window, per period and per product.

UsageResponse

JavaScript: Usage · Python: viewrium.UsageResponse

startdatetimerequired

The window's start (default: 30 days before end).

enddatetimerequired

The window's end (default: now).

granularitystringrequired

The bucket size: hour or day (default).

One of "hour", "day"

bucketsUsageBucket[]required

Event counts per period and event type.

totalsmap of string to integerrequired

Event type -> count over the whole window.

durationsmap of string to UsageDurationoptional

Event type -> AR session length over the window. Only ever keyed by ar_session_ended, and absent when nothing reported one.

by_productUsageProductTotals[]optional

Per-product totals, best first and capped. Empty unless group_by=product asked for them.

UsageBucket

JavaScript: no alias - an element of the type that holds it · Python: viewrium.UsageBucket

period_startdatetimerequired

The start of the hour or day this bucket covers.

event_typeUsageEventTyperequired

The event counted.

One of "generation.created", "generation.completed", "generation.failed", "view", "ar_enter", "ar_session_ended"

countintegerrequired

How many events of this type fell in the period.

cost_centsnumberoptionalnullable

The summed cost of the bucket's priced events, in cents. Null when none carried a price.

durationUsageDurationoptionalnullable

AR session length; set only for ar_session_ended, and null when no event in the bucket reported one.

UsageDuration

JavaScript: no alias - an element of the type that holds it · Python: viewrium.UsageDuration

Total AR session time and how many sessions reported one. The average session is total_ms / count; count is not the bucket's event count, because not every session reports a duration.

total_msintegerrequired

Summed AR session length in milliseconds.

countintegerrequired

How many sessions contributed a duration - the divisor for an average (total_ms / count).

UsageProductTotals

JavaScript: UsageProductTotals · Python: viewrium.UsageProductTotals

One product's event counts over the window, with its title. Returned when group_by=product.

product_iduuidrequired

The product.

titlestringoptionalnullable

The product's title.

totalsmap of string to integerrequired

Event type -> count over the window.

On this page