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

/traffic/related

This API allows to retrieve similar items based on the recent page views and can be used to get insights such as:

  • "People who viewed a page X have also viewed ..."

  • "People who entered query Q have also entered ...".

For a particular item of interest, the algorithm first finds a corresponding population of users. Then, it looks at the other events from this user population, finds a set of the most popular items, ranks the candidates with by their interestingness and returns the top-results.

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

This API is experimental and might be changed in future. The only supported type is currently event.

Request

The request object has the following fields:

Name

Type

Required

Description

siteId

String

No

The site to aggregate over. A more convenient alternative to siteIds, in the case of just one site.

siteIds

Array of String

No

The set of sites to aggregate over.

siteGroupId

String

No

The site group to aggregate over. A more convenient alternative to siteGroupIds, in the case of just one site group.

siteGroupIds

Array of String

No

The set of site groups to aggregate over.

start

Integer or String

No

The start time of the aggregation period specified according to

Traffic time specification

. The default value is one hour ago.

stop

Integer or String

No

The stop time of the aggregation period specified according to

Traffic time specification

. The default value is right now.

type

String

Yes

The type of data. Currently is restricted to 'event'.

group

String

Yes

The group of interest. See

/traffic/event

.

item

String

Yes

The item of interest.

filters

Array of Object

No

The filters to be applied. Filter syntax is documented

here

. Conjunctive semantics (and) are assumed for the top-level filters.

count

Integer

No

The maximum number of items to return for each group. The default value is 10, the maximum value is 20.

mode

String

No

Similar to the explodeUsers filter, this API can select either all user events ("mode":"allEvents" or no mode specified) or starting only the original event ("mode":"consecutiveEvents").

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

.

groups

Array of Object

Contains a single group object described below, or is empty if no similar items were found.

The group object has the following fields:

Name

Type

Description

group

String

The name of the group, e.g., 'url'.

items

Array of Object

The list of similar items ordered by decreasing interestingness.

Examples

Bash
$ python cx.py /traffic/related '{"start":-86400, "type":"event", "group":"url", "item":"https://cxnews.azurewebsites.net/articles/tech/snapchat-just-made-huge-move-mobile-payments-003004928", "count":5, "start":"-1d"}'
{
 "start": 1416225020,
 "stop": 1416311420,
 "groups": [
 {
 "items": [
 {
 "item": "https://cxnews.azurewebsites.net/articles/tech/snapchat-blames-third-party-apps-leaked-photos-212851215--finance"
 },
 {
 "item": "https://cxnews.azurewebsites.net/search"
 },
 {
 "item": "https://cxnews.azurewebsites.net/articles/business/yahoo-plans-invest-snapchat-wsj-194413249--sector"
 },
 {
 "item": "https://cxnews.azurewebsites.net/articles/tech/photo-saving-snapsaved-com-claims-hackers-stole-snapchat-181752904"
 },
 {
 "item": "https://cxnews.azurewebsites.net/articles/tech/snapchat-breach-exposes-flawed-premise-security-challenge-234148982--sector"
 }
 ],
 "group": "url"
 }
 ]
}
Bash
$ python cx.py /traffic/related '{"start":-86400,"siteId":"1234567890","count":5,"type":"event","group":"query","item":"birken","count":10}'
{
 "start": 1363862737,
 "stop": 1363949137,
 "groups": {
 "group": "query",
 "items": [
 {
 "item": "elste p\u00e5 birken"
 },
 {
 "item": "birken resultater"
 },
 {
 "item": "eiulf"
 },
 {
 "item": "birkebeinerrittet"
 },
 {
 "item": "birken-tv"
 },
 {
 "item": "birkebeinerrennet video"
 },
 {
 "item": "birken 2013"
 },
 {
 "item": "akland"
 },
 {
 "item": "birkebeiner 2013"
 },
 {
 "item": "birkebeinerrennet"
 }
 ]
 }
}
Bash
$ python cx.py /traffic/related '{"siteId":"12345", "type":"event", "group":"city", "item":"alta", "start":"-1d", "count":10}'
{
 "start": 1363862737,
 "stop": 1363949137,
 "groups": {
 "group": "city",
 "items": [
 {
 "item": "storslett"
 },
 {
 "item": "strommen"
 },
 {
 "item": "harstad"
 },
 {
 "item": "bodo"
 },
 {
 "item": "kautokeino"
 },
 {
 "item": "burfjord"
 },
 {
 "item": "trondheim"
 },
 {
 "item": "stathelle"
 },
 {
 "item": "kirkenes"
 },
 {
 "item": "vadso"
 }
 ]
 }
}

Last updated: