A Google Analytics dashboard in your Wagtail admin
Clone or download
Latest commit d71d5d8 Oct 12, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
client Enable file export Jun 18, 2018
wagalytics
.gitignore Use webpack to bundle the assets for es5 May 2, 2017
LICENSE Create License Aug 31, 2017
MANIFEST.in
README.md
package-lock.json Improve page style and fix pagination bug Jun 17, 2018
package.json Add dist to package.json, update package-lock.json Aug 29, 2018
screenshot.png Update screenshots Jun 18, 2018
setup.cfg version bumps, package fixes Feb 24, 2016
setup.py Add forgotten pyexcel-ods dependency Jun 18, 2018
wagalytics-page-stats.png Update screenshots Jun 18, 2018

README.md

Wagtail Analytics

This module provides a simple dashboard of Google Analytics data, integrated into the Wagtail admin UI. Tested on Wagtail 1.4+.

Screenshot

Screenshot

Instructions

  1. Create a service account and download the JSON key (Credentials > Create Credentials > API key)
  2. Make sure the Analytics API is enabled for your project (See issue 2)
  3. Add the service account email address as a read-only user in Google Analytics (Admin > User Management)
  4. Find the ID for your Google Analytics property (Admin > Property > View Settings, note: this is NOT the key that begins with "UA-")
  5. Store your JSON key somewhere safe, and do not check it into your repo
  6. pip install wagalytics
  7. Add 'wagalytics' to your INSTALLED_APPS
  8. Add 'wagtailfontawesome' to INSTALLED_APPS if it's not there already
  9. Update your settings:
  • GA_KEY_FILEPATH = '/path/to/secure/directory/your-key.json'

or when using environment variables (e.g. Heroku):

  • GA_KEY_CONTENT = 'content_of_your_key.json'
  • GA_VIEW_ID = 'ga:xxxxxxxx'

If you get CryptoUnavailableError errors, you probably need to pip install PyOpenSSL and/or pip install pycrypto. See StackOverflow.

Ensure that your code snippet is included on each page you want to be tracked (likely by putting it in your base.html template.) (Admin > Property > Tracking Code)

Wagalytics Developers

Developers will need to carry out the following steps after cloning wagalytics:

  • Ensure NodeJS & NPM are installed
  • Run npm install then npm run build in the top level wagalytics directory

You will need to run npm run build anytime the javascript source is updated.

TODO

  • allow configuration of results
  • better styling, e.g. using chart.js
  • Throw an error if the relevant settings aren't available
  • add per-page results

Notes

This module doesn't help with recording user activity. See the Wagtail docs and StackOverflow for pointers on how to avoid gathering data during preview and testing.

Contributors

  • Thijs Kramer
  • Stefan Schärmeli
  • Alex Gleason
  • James Ramm