#2259 - New stats/KPI system

Identifier #2259
Issue type Feature request or suggestion
Title New stats/KPI system
Status Completed
Tags

Type: External social media integration (custom)

Handling member Chris Graham
Addon stats
Description This specification is for rewriting the whole Composr CMS stats module into a much more powerful and useful system that makes marketing and line management of staff much more efficient.

The new stats would be based around the philosophy of providing diverse context-specific information rather than very advanced Google Analytics-style filtering of generic hit data. We are not trying to replace GA, we are trying to provide something more suitable for quick reference, integrate well with Composr, and provide diverse meaningful data GA cannot. GA will still be better for advanced data analysis by marketing professionals (including split testing, multi-step goal tracking, adsense tracking), and we will still recommend people set up and use GA. For example, we will no longer be breaking down top referrers and browsers on a page-by-page basis, because overall graphs are good enough and easier to access.

The new front-end to the admin_stats module would provide a do-next interface with these top level icons:
- Google Analytics [if configured]
- Performance tracking (line graphs)
- Successes (bar charts)
- Member map [if Latitude and Longitude CPFs are available]
- Defined KPIs [explained further down]
- Geo-location data install [if not already installed]
- (anything else a hook adds as a new menu item)

tut_statistics will continue to be linked from the helper panel. The helper panel should provide a shortcut to the stats configuration in the overview help.

Our bespoke SVG graphing system can go, in favour of a http://www.chartjs.org/ solution.

If you clicked through to line graphs, you'd then get to choose which graph type to view. Each graph type also has a number of its own settings and shared settings.
Shared settings:
- From date
- To date
- Measurement window size (1 day, 1 week, 1 month) [needs to somehow clearly explain this is what it bunches the data up into]

The available line graphs, with settings:
- Content submission (settings: content type [optional], submitter [optional])
- Tracking-code referrals (settings: tracking code [optional]) [this will need a new table, stats_tracking_codes, populated dynamically; "_t" tracking parameter must be standardised and documented]
- Member referrals (settings: referring member [optional]) [this will need a new table, stats_member_referrals, populated dynamically]
- Page views (settings: match-key [optional])
- Page views by members per member (settings: only active members [optional], member join recency [optional], match-key [optional])
- Download downloads (settings: download ID [optional])
- Attachment downloads (settings: attachment ID [optional]) [copied daily into stats_aggregate_tracker]
- Member accounts
- Newsletters sent [this is just a specialisation of admin actions, it can share a base class]
- Banner views (settings: banner type SQL wildcard pattern [optional]) [copied daily into stats_aggregate_tracker]
- Banner clicks (settings: banner type SQL wildcard pattern [optional]) [copied daily into stats_aggregate_tracker]
- Support tickets created
- Support tickets open
- Alexa ranking (settings: URL [defaults to base URL]) [copied daily into stats_aggregate_tracker]
- Google ranking (settings: URL [defaults to base URL], keyword) [copied daily into stats_aggregate_tracker] [use https://developers.google.com/webmaster-tools/v3/how-tos/search_analytics#verify--the-presence-of-data - will work for already-working keywords only]
- Website comments
- Errors in log [copied daily into stats_aggregate_tracker]
- Server CPU load (settings: trough/peak/average [defaults to average]) [trough/peak/average-diffed daily into stats_aggregate_tracker]
- Server memory usage (settings: trough/peak/average [defaults to average]) [trough/peak/average-diffed daily into stats_aggregate_tracker]
- Server I/O (settings: trough/peak/average [defaults to average]) [trough/peak/average-diffed daily into stats_aggregate_tracker]
- Free disk space [copied daily into stats_aggregate_tracker]
- Recommendations sent
- Poll votes [copied daily into stats_aggregate_tracker]
- Quiz entries (settings: quiz ID [optional])
- Points earned [copied daily into stats_aggregate_tracker]
- Points earned per member (settings: only active members [optional], member join recency [optional]) [copied daily into stats_aggregate_tracker]
- Points gifted [copied daily into stats_aggregate_tracker]
- Points gifted per member (settings: only active members [optional], member join recency [optional]) [copied daily into stats_aggregate_tracker]
- Newsletter signups [copied daily into stats_aggregate_tracker]
- Admin action (settings: action log type [optional])
- eCommerce sales in currency units
- eCommerce transaction count
- Users online at once [needs better way of logging this]
- Rating actions
- Rating actions by members per member (settings: only active members [optional], member join recency [optional], match-key [optional]) [copied daily into stats_aggregate_tracker]
- Referers detected [need new table, stats_referers]
(NB: We may decide to just put everything into stats_aggregate_tracker daily for performance reasons)

The available bar charts, with settings:
- Incoming search keywords [requires Google Analytics API integration]
- Internal search keywords
- Slow page-links
- Referrer URLs
- Demographic ranges
- Members by forum posts
- Members by points
- Members by visits
- Hits by IP addresses
- User agents
- Countries
- Content by views (settings: content type [optional], submitter [optional])
- Content by rating (settings: content type [optional], submitter [optional])
- Content by comment count (settings: content type [optional], submitter [optional])
- Forum topics by post count
- Website usage by hour
- Custom Profile Field list value selection (settings: field title)
(think of these as showing the 'top' of each - but you can also paginate through to see the bottom of each)

API: https://developers.google.com/analytics/ [Google Analytics]

Graphs should have tooltip labels, saying what the data point is and what its value is.

For all the line graphs and bar charts we will show pagination underneath, to allow full browsing through the data. The graphs would show the data for the particular segment of the data set you're looking at. It obviously sorts by descending order of the measured quantity.

CSV links will continue to show, to allow all the data to be easily downloaded.

All data will be shown in the site timezone, and there'll be a label saying as such.

New CRON hooks are needed:
- Data collectors would run via the CRON system on a daily basis. They would do things like see how much a resource's views had gone up since the last check, and log that figure into the stats_aggregate_tracker table. The data would be collected as close to after midnight on whatever timezone the site is configured to. The individual stats hooks would provide the code that the CRON hook would call (this is referenced further down).
- There would be a CRON hook that runs every cycle, logging memory usage, server load, free disk space, and disk IO (if it can get them) to a new stats_server_metrics table.

For things that must be aggregated using CRON that you are filtering with a non-default filter, you can only see that filtered data if it is set up as a KPI. You'll get an error message saying as much if you try and do a filter and there's no data available.

The entire system will be hook based. No particular graphs will be hard-coded into the admin_stats module anymore. Hooks should handle:
- Stat screen hooks:
- Extra icon for top level do-next menu
- Extra full screen
- Bar chart hooks & Line graph hooks:
- Provide data for graph
- Enumerate possible settings
- Gather daily data (i.e. so the CRON hook can call into them)

Block caching for all rendered graphs.

Any graph would have a "Add as KPI" link under it. These KPIs are added to the system as things to track on an ongoing basis. When added, it would ask for:
- a list of username(s) that has responsibility for the KPI
- a note
- a target figure
- whether the target is a differential per week or a differential per month or a flat total
- whether that target is a minimum or a maximum

KPIs could be deleted from the view KPIs screen. That screen would also show a table ("KPI summary table") of all the KPIs and their settings, the current measurement, the current target, whether it is being passed, and a link to view the full graph. Red would be used to indicate failing KPIs.

New staff notifications would be added to the system:
- Weekly KPI report (my KPIs)
- Weekly KPI report (all KPIs)
These would email out the KPI summary table (explained above) on a weekly basis.
(The staff checklist report would also include these things, in more-summarised form)

The staff checklist block on the Admin Zone dashboard would also summarise all the KPIs, via a simplified read-out compatible with the data already shown there.

There would be a new block (main_staff_stats_graph) that could render any particular graph. Webmasters may use this to add lots onto the Admin Zone dashboard screen. There would be another block (main_staff_stats_kpi) that shows all the configured KPI graphs.

Peripheral tasks:
- The stats table should be redesigned to store "zone:page" rather than the paths of pages
- Tear out the old SVG framework we were maintaining
- Update the tut_statistics tutorial
- Copy archive.org link of main_website_monitoring to "Useful external links"
- Remove main_website_monitoring block, and its reference from the Admin Zone dashboard (it overlaps with our new system and we don't need it)
- Make sure there's a link to some back-link-finder tool in "Useful external links"
- Remove the following main_staff_checklist hooks and associated config options (as these are now re-implementable as KPIs)
- newsletter
- blog
- news
- Add a note in http://compo.sr/tracker/view.php?id=1965 that we can potentially implement more stats integration for other services
- Decacher script must no longer decache the old .xml files, and any references to them must be removed
- Our page stats cleanup hook will need to remove data from some of the new stats tables
- Add chartjs references to license file, upstream tracking issues, .editor_config, line_count.sh

YouTube addon
-------------

Extra line graphs:
- YouTube videos posted (settings: Youtube account ID [defaults to configured one]) [copied daily into stats_aggregate_tracker]
- YouTube videos comments received (settings: Youtube account ID [defaults to configured one]) [copied daily into stats_aggregate_tracker]
- YouTube videos average rating (settings: Youtube account ID [defaults to configured one]) [copied daily into stats_aggregate_tracker]
- YouTube videos views (settings: Youtube account ID [defaults to configured one]) [copied daily into stats_aggregate_tracker]
- YouTube subscribers (settings: Youtube account ID [defaults to configured one]) [copied daily into stats_aggregate_tracker]

Extra bar charts:
- Most engaging users on YouTube
- Popular videos

API: https://developers.google.com/youtube/reporting/#Report_Contents

Twitter addon
-------------

Extra line graphs:
- Tweets made (settings: twitter account name [defaults to configured one]) [copied daily into stats_aggregate_tracker]
- Twitter followers (settings: twitter account name [defaults to configured one]) [copied daily into stats_aggregate_tracker]
- Twitter mentions (settings: twitter account name [defaults to configured one]) [copied daily into stats_aggregate_tracker]
- Twitter retweets (settings: twitter account name [defaults to configured one]) [copied daily into stats_aggregate_tracker]

Extra bar charts:
- Most engaging users on Twitter
- Popular Tweets

API: https://dev.twitter.com/rest/public

Facebook addon
--------------

Extra line graphs:
- Facebook posts made (settings: Facebook page ID [defaults to configured one]) [copied daily into stats_aggregate_tracker]
- Facebook page likes (settings: Facebook page ID [defaults to configured one]) [copied daily into stats_aggregate_tracker]
- Facebook page visits (settings: Facebook page ID [defaults to configured one]) [copied daily into stats_aggregate_tracker]
- Facebook reach (settings: Facebook page ID [defaults to configured one]) [copied daily into stats_aggregate_tracker]
- Facebook post likes (settings: Facebook page ID [defaults to configured one]) [copied daily into stats_aggregate_tracker]
- References on Facebook (settings: domain name [defaults to base URL domain name]) [copied daily into stats_aggregate_tracker]
- Links from Facebook (settings: domain name [defaults to base URL domain name]) [copied daily into stats_aggregate_tracker]

Extra bar charts:
- Most engaging users on Facebook
- Popular Facebook posts

API: https://developers.facebook.com/docs/platforminsights/page
API: https://developers.facebook.com/docs/platforminsights/domains (for references and links) (requires some setup in <head>)

Google adsense addon
--------------------

Extra line graphs:
- Money in account (settings: account ID)

API: https://developers.google.com/adsense/management/

Google Play Store addon / Apple Appstore addon
----------------------------------------------

(implemented completely separately for both with name prefixes, but repeated here to avoid copy&pasting)

Extra line graphs:
- App installs (settings: app ID) [copied daily into stats_aggregate_tracker]
- App uninstalls (settings: app ID) [copied daily into stats_aggregate_tracker]
- App rating (settings: app ID) [copied daily into stats_aggregate_tracker]
- App error reports (settings: app ID) [copied daily into stats_aggregate_tracker]
- App store keyword ranking (settings: app ID, keyword) [copied daily into stats_aggregate_tracker]
- App store category ranking (settings: app ID, category ID) [copied daily into stats_aggregate_tracker]

Extra bar charts:
- App demographic ranges (settings: app ID)
- App versions (settings: app ID)
- iOS/Android version (settings: app ID)
- App countries (settings: app ID)
- App usage by hour

(access details may be needed for settings too, not sure)

API: http://docs.appfigures.com/api/reference/v2/sales (meta-data)
API: http://docs.appfigures.com/products#searching_for_products (keyword ranking)
API: http://docs.appfigures.com/api/reference/v2/ranks (category ranking)
Steps to reproduce

Related to

#3149 - Improved Google Analytics tracking

#603 - Newsletter tracking, include tracking code integration

#2980 - Social media integration review and documentation

Funded? No
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".

Rating

Unrated