We’ve migrated our documentation to a new site, which means some URLs have changed.
Audience

/traffic/event

This API produces an aggregated top-list of items associated with events, called "groups" as parameter. Data associated with the events includes information related to device usage, location, search queries and URL navigation.

The user must be authenticated and have read permissions to the specified sites.

Current aggregation period and filter restrictions are as follows:

Period

Fields available

Filters available

Notes

Last 31 days or less or as specified by

long term storage

All

All

More than 31 days ago without

long term storage

Only events and sessionStarts

None

The number of page views and the number of user sessions initiated in the specified period can be retrieved.

Top-list items returned for the groups url,referrerUrl or exitLinkUrl are merged by the normalized url, normalized canonical url and/or the [the article id](page://Cxense Content - Review and Refinement). The returned item corresponds to the canonical url (if any was found) or a semi-normalized url.

Request

Identical to /traffic with the following additional fields:

Name

Type

Required

Description

groups

Array of String

No

The specific groups to aggregate. The list cannot be empty. If the groups field is not specified then all groups will be returned. See

Event groups

for available groups.

count

Integer

No

The maximum number of items to return for each group. The default value is 10, the maximum value is 1000. Note that the data might be distributed across multiple computers, where we retrieve only a number of items from each. The exact number is a multiple of the count parameter. Therefore, if the distribution is very flat (i.e., there are lots of items, but none are significantly more popular than others) the aggregated numbers might be a bit off. Using a larger count may help in this case.

orderBy

String

No

The field to be used for item ordering within each group. By default the items are ordered by descending event count, i.e., by popularity. Alternatively, activeTime, uniqueUsers or urls can be used. In this case, the orderBy field should be among the aggregated fields. Note that ordering is done only on popular items. Unpopular items, even those that have a high value of the specified field, will not be included in the result.

Fields

Identical to /traffic. Additional fields partially supported by this method are:

Field

Implicit

Descriptions

title

No

Resolves the title/description of the aggregated item.

Event groups

A complete list over all event groups that can be aggregated over can be found here.

Response

The response object has the following fields:

Name

Type

Description

start

Integer

The start time of the aggregation period in seconds, measured in

Unix time

.

stop

Integer

The stop time of the aggregation period in seconds, measured in

Unix time

.

data

Object

The field names and aggregated numbers.

groups

Array of Object

The aggregated groups.

history

Integer

The start times of the aggregated history buckets. With n buckets, it contains (n + 1) values, where the last value is the stop time of the last bucket.

Each group consists of a group name and a top list of the aggregated items:

Name

Type

Description

group

String

The name of the group.

items

Array of Object

The set of items aggregated for this group. See the comment on the count request parameter given above.

Each item consists of the following fields:

Name

Type

Description

item

String

The name of the item.

title

String

The title/description of the item. The field is set only if it specified by the request and is currently supported only for the url group.

data

Object

The field names and aggregated numbers.

historyData

Object

The field names and lists of aggregated numbers.

Examples

Bash
$ python cx.py /traffic/event '{"siteId":"12345", "groups":["url"], "fields":["uniqueUsers"], "filters":[{"type":"event","group":"referrerHost","item":"google.com"}], "count":1}'
{
 "start": 1416299811,
 "stop": 1416303411,
 "data": {
 "events": 4, 
 "uniqueUsers": 4
 },
 "groups": [
 {
 "items": [
 {
 "item": "https://cxnews.azurewebsites.net",
 "data": {
 "uniqueUsers": 6,
 "events": 6
 }
 }
 ],
 "group": "url"
 }
 ]
}
Bash
$ python cx.py /traffic/event '{"siteId":"12345", "groups":["deviceType"], "fields":["uniqueUsers","activeTime","sessionStarts"], "filters":[{"type":"event","group":"referrerHost","item":"google.com"}]}'
{
 "start": 1416299976,
 "stop": 1416303576,
 "data": {
 "events": 178, 
 "uniqueUsers": 160, 
 "afterReportEvents": 0, 
 "activeTime": 0, 
 "sessionStarts": 159
 },
 "groups": [
 {
 "items": [
 {
 "item": "Mobile",
 "data": {
 "uniqueUsers": 40,
 "events": 40,
 "sessionStarts": 35
 }
 },
 {
 "item": "Desktop",
 "data": {
 "uniqueUsers": 18,
 "events": 18,
 "sessionStarts": 17
 }
 },
 {
 "item": "Tablet",
 "data": {
 "uniqueUsers": 5,
 "events": 5,
 "sessionStarts": 5
 }
 }
 ],
 "group": "deviceType"
 }
 ]
}
Bash
$ python cx.py /traffic/event '{"siteId":"12345", "groups":["url"], "fields":["events","uniqueUsers"], "orderBy":"uniqueUsers", "count":3}'
{
 "start": 1416300138,
 "stop": 1416303738,
 "data": {
 "events": 1156, 
 "uniqueUsers": 768
 }, 
 "groups": [
 {
 "items": [
 {
 "item": "https://cxnews.azurewebsites.net",
 "data": {
 "uniqueUsers": 46,
 "events": 46
 }
 },
 {
 "item": "https://cxnews.azurewebsites.net/articles/business/stocks-junk-bonds-show-investor-jitters-155514268",
 "data": {
 "uniqueUsers": 14,
 "events": 14
 }
 },
 {
 "item": "https://cxnews.azurewebsites.net/articles/business/roche-buy-u-biotech-firm-intermune-8-3-083138154--finance",
 "data": {
 "uniqueUsers": 11,
 "events": 11
 }
 }
 ],
 "group": "url"
 }
 ]
}
Bash
$ python cx.py /traffic/event '{"siteIds":["12345"], "groups":["deviceType"], "start":"2014-11-15T00:00:00.0Z", "historyFields":["events"], "historyResolution":"day"}'
{
 "start": 1416009600,
 "stop": 1416303922,
 "history": [
 1668470400, 
 1668556800, 
 1668643200, 
 1668729600, 
 1668816000, 
 1668902400, 
 1668988800, 
 1669075200, 
 1669161600, 
 1669248000, 
 1669334400, 
 1669379129
 ], 
 "data": {
 "events": 233450
 },
 "groups": [
 {
 "items": [
 {
 "item": "Mobile",
 "historyData": {
 "events": [
 8415,
 9470,
 8868,
 4074
 ]
 },
 "data": {
 "events": 30827
 }
 },
 {
 "item": "Desktop",
 "historyData": {
 "events": [
 4181,
 4854,
 4517,
 2000
 ]
 },
 "data": {
 "events": 15552
 }
 },
 {
 "item": "Tablet",
 "historyData": {
 "events": [
 1738,
 1911,
 1806,
 776
 ]
 },
 "data": {
 "events": 6231
 }
 }
 ],
 "group": "deviceType"
 }
 ],
 "history": [
 1416009600,
 1416096000,
 1416182400,
 1416268800,
 1416303922
 ]
}

Last updated: