Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The console is powered primarily by stored and reusable MongoDB queries, which requires some familiarity with JSON and the way Mongoose databases are queried. 

The default queries view will list the query name and it's type, and some simple create/edit/delete options. 

Writing mongo queries for the first time can be quite intimidating - luckily however, the analytics console provides the query playground, for users to build out and test their own custom queries. 

...

Luckily, we have a query for that:

Code Block
languagejs
themeMidnight
[
	{
		"$sort":{"date":-1}
	},
	{
		"$limit":"#n#"
	}
]

...

Hit apply, and watch what happens next. 


Code Block
languagejs
themeMidnight
{
  "utilities": [
    {
      "_id": "594376d9f59a7c6d1cb00e19",
      "name": "Server CLI Request",
      "tags": {
        "value": 1497509350209,
        "label": "kynan",
        "action": "Stop",
        "category": "Videos"
      },
      "date": "2017-06-16T06:12:41.402Z",
      "__v": 0
    },
    {
      "_id": "594376d9f59a7c6d1cb00e18",
      "name": "Server CLI Request",
      "tags": {
        "value": 1497509263823,
        "label": "aaron",
        "action": "Start",
        "category": "Videos"
      },
      "date": "2017-06-16T06:12:41.402Z",
      "__v": 0
    }
  ]
}


Your output will always be returned in JSON format, inside an utilities array. These events here are custom events collected using the JavaScript SDK. the _id and name values are preconfigured by the SDK, acting as an identifier and the service the request was made from. At this stage, custom analytics events will all be returned with the name "Server CLI Request". The tags section contains the custom analytics data.


Query These Events