Query Statistics about your contents

There are a diffent kind of informations you can get from your instance's activity. If you are interested about informations on the contents itself you should probably go with a search query.

You can then choose to query stats on content level (activiy on a single content), space level (activity in space) or instance level (every activity in your instance).

Entry point for instance stats is in query.instance.statistics. Entry point for space stats is in query.space.statistics. Entry point for content stats is in query.story.analytics.

You'll often need to provide a time range and dependending on the query, a "grouping interval".

For exemple, quering informations about your active users might go as following:

graphql
query InstanceStatsQuery {
instance {
statistics {
activeUsersCount(fromDate: "2021-01-01T00:00:00", toDate: "2021-05-01T00:00:00")
usersActivity(fromDate: "2021-01-01T00:00:00", toDate: "2021-05-01T00:00:00", tickInterval: WEEK)
mostActiveUsers(fromDate: "2021-01-01T00:00:00", toDate: "2021-05-01T00:00:00", first: 10) {
nodes {
user {
name
}
stats
}
}
}
}
}

Expected result:

response
{
"data": {
"instance": {
"statistics": {
"activeUsersCount": 28,
"usersActivity": [
["2021-01-01T01:00:00Z", 13],
["2021-01-08T01:00:00Z", 13]
],
"mostActiveUsers": {
"nodes": [
{
"user": {
"name": "Knowledge Master"
},
"stats": {
"likes": 0,
"comments": 0,
"views": 3221,
"posts": 0,
"all_events": 3695
}
},
{
"user": {
"name": "Jane Doe"
},
"stats": {
"likes": 0,
"comments": 7,
"views": 697,
"posts": 62,
"all_events": 1085
}
}
]
}
}
}
}
}

Was this page helpful?