Metrics for Mozilla Webmaker
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets
cert
lib
sql
views
.bowerrc
.editorconfig
.gitignore
.jshintrc
Gulpfile.js
LICENSE
Procfile
README.md
app.js
bower.json
crunch.js
nodemon.json
package.json
sample.env

README.md

Webmaker Metrics

Introduction

Crunching some Webmaker numbers and reporting on them.

  • Referral Dashboard for Engagement team to understand impact of marketing campaigns
  • Webmaker KPI dashboard for product team to understand impact of changes to the product

Structure

  • crunch.js does the crunching of the raw data to produce the aggregates
  • app.js provides front-end routes to the aggregate data

Data

This app stores aggregate snapshots of data in a local database. The structure for this local data is automatically generated by sequelize. The models for this data are found in lib/models.js. This data is used for the front-end reporting.

This app also analyzes data from a seperate mofointegration database. This database contains a nightly snapshot of the Webmaker databases from across the multiple webmaker apps and sites. This app has readonly access to a selection of Views on the mofointegration DB which expose the necessary data but not PII (email addresses are obfuscated). Modifying these views requires admin rights to the mofointegration database.

About Webmaker Retention Metrics

Webmaker stores an account creation date, and a last updated date. A user who is innactive one day, may then be retained the following day if they log back in. This means regularly daily snapshots of retention rate will report differently from a backdated analysis of the data, where periods of inactivity are hidden by the most recent activity.

For daily tracking of 7 day retention rate, we are reporting on the % of users who joined 7-14 days prior to the snapshot date who were active (updatedAt) more than 7 days after their account creation. The same applies to 30 day retention, but we look at the users who signed up 30-37 days prior to the snapshot date. This model is consistent assuming daily snapshots.

Initial setup

  • copy sample.env to .env
  • you will need a bunch of credentials - ask Adam / JP or others for these
  • Generate the local HTTPS key and cert as noted below
  • npm install
  • bower install

Development

$ foreman run node crunch.js
$ foreman run node crunch.js productKPIs #to run a particular function
$ foreman run nodemon app.js

Notes

$ heroku config:set NODE_ENV=production

Utils

  • /util/crunch7daysProduct

Google Analytics Auth

  • Visit this path https://localhost:8888/ga/auth (or the production equivilent)
  • Login using the LOCAL_AUTH_USERNAME and LOCAL_AUTH_PASSWORD set in the env
  • Authenticate with a Google Account that has access to the Webmaker GA profile
  • This app will store a token so it can continue to talk to GA using your GA account after you finish your session

GA API settings

  • Configured here: https://code.google.com/apis/console
  • App URLs have to be configured in the Google Developer Console. For local development, this is setup to work with https://localhost:8888/ga/oauth2callback, this will fall over if you use another port, or don't use HTTPS.

Localhost HTTPS

You will need to generate a self-signed certificate for local development over HTTPS. See http://docs.nodejitsu.com/articles/HTTP/servers/how-to-create-a-HTTPS-server

Save the key and the cert here:

/config/key.pem
/config/cert.pem

Public URLs for Geckoboard

UV to New User

Retention 7 Day

Retention 30 Day