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 |
|---|---|---|---|
|
|
String |
No |
The site to aggregate over. A more convenient alternative to |
|
|
Array of String |
No |
The set of sites to aggregate over. |
|
|
String |
No |
The site group to aggregate over. A more convenient alternative to |
|
|
Array of String |
No |
The set of site groups to aggregate over. |
|
|
Integer or String |
No |
The start time of the aggregation period specified according to Traffic time specification . The default value is one hour ago. |
|
|
Integer or String |
No |
The stop time of the aggregation period specified according to Traffic time specification . The default value is right now. |
|
|
String |
Yes |
The type of data. Currently is restricted to |
|
|
String |
Yes |
The group of interest. See /traffic/event . |
|
|
String |
Yes |
The item of interest. |
|
|
Array of Object |
No |
The filters to be applied. Filter syntax is documented here . Conjunctive semantics ( |
|
|
Integer |
No |
The maximum number of items to return for each group. The default value is |
|
|
String |
No |
Similar to the |
Response
The response object has the following fields:
|
Name |
Type |
Description |
|---|---|---|
|
|
Integer |
The start time of the aggregation period in seconds, measured in Unix time . |
|
|
Integer |
The stop time of the aggregation period in seconds, measured in Unix time . |
|
|
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 |
|---|---|---|
|
|
String |
The name of the group, e.g., ' |
|
|
Array of Object |
The list of similar items ordered by decreasing interestingness. |
Examples
$ 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"
}
]
}
$ 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"
}
]
}
}
$ 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"
}
]
}
}