1.8 Guide – Statistics Add-on

ststistics-add-on-v1.8-guide

Statistics 2.0

The Statistics add-on has received a complete re-write in order to add support for showing charts and statistical data on the front end of your website. The add-on comes with pre-set types of data that you can select to show either as a table or using charts (or both).
Bar chart in Overview

Depending on your websites size or the number of transaction it processes, querying these data can be “expensive”. So to minimize load on your database, results are “cached”. By default, these data is updated each time a users balance changes or if a log entry is added / edited / deleted. But you can also select if you want to store data longer and only update it once an hour, every six hours, twice a day or once a day. This way, sites with large number of transactions will not need to query new stats on every transaction.

All charts are powered by Charts.js 2.7.0

New Shortcodes

You can create charts using the following new shortcodes:

Shortcode Description
This shortcode will render charts based on the amount of points that currently exists amongst your users for each point type.
This shortcode will render charts based on the amount of points that has been given to users vs. the total amount taken.
This shortcode will render the average point gain on your site for x number of days/weeks/months/years
This shortcode will render a list of balances ordered by size.
This shortcode will render a list of the most common ways your users gain points on your site based on references.
This shortcode will render the total amount of points your users has gained / lost on a daily/weekly/monthly/yearly basis.
This shortcode will render the total amount of points a specific user has gained / lost on a daily/weekly/monthly/yearly basis.

Chart Types

Depending on which shortcode you select to use, you can choose between: Line charts, Bar Charts, Radar Charts, Pie Chart, Doughnut Charts and Radial Charts.

New Settings

As of version 2.0, the Statistics add-on will have it’s own tab on the settings page. This is where you can set optimization options and colors for each point type.

New Stats Settings
Optimization options is only available under your main point type (if you have more than one).

For Developers

The new myCred_Chart object has been added to help render charts. When using this object, we render canvas elements where the chart will be rendered, while the actual data is populated under the $mycred_charts global. This global is then fed to Chart.js in the footer of the website. This means that charts will not render if the wp_footer function is used!

Share:

11