Analytics Console: Configuring Widgets
- Aaron Roworth
Right now, we have a bar graph, but it isn't displaying any data, yet.
Before, you probably noticed the handful of query options in the widget options window, when we were editing the title and title colour.Â
Search Parameters
Here, we need select the query we wish to display, and the collector the analytics data is coming from.
Next, we need to pass in some search Parameters. If you look above, we're using the Actions in Specific Category query we set up earlier. If you look at the query syntax, you can see that it asks for the values cat, gte and lte.
The parameter window auto-detects these, as you can see above, and asks the user for the 3 values.Â
dateminusmin is a custom property we can pass into the gte and lte fields. It states the amount of seconds that have taken place since the current date, which we can use to set up a range between 0 seconds and 42000 seconds, equating to roughly a month.
Properties of X
Take a look at the query syntax again - in the group stage, we pass a parameter of _id in order to group our matched results by. Since we passed the value of actions to _id, and we wish to group by actions on the bottom of the graph, we give the key for x a value of _id. This tells it to use the _id, or actions value to group our results.Â
We already know that we'll be grouping these along the bottom, so the position value is left as bottom.
Since we're just passing in a string and expecting the graph to group the results based on that value, we treat the type here as a category.
Properties of Y
If you take a look back to the query syntax, where the _id value is declared, we can see a second value below it, called count. These values have been grouped together in the group section, and since we're already using _id as our X value, we'll use count as our Y value.
The position can remain unchanged, as we wish to tally the count up the left hand side of the graph.Â
Since we're dealing with an incrementing number for this value, we can use the type of linear.
End Result
If everything has worked correctly, and your values are configured correctly, you should see your graph populate with data:
If there's issues with your data displaying, check your query syntax and ensure everything is set up correctly. You should be confident that your queries are working in the query playground and displaying data, before you try to build widgets out of them.