Code Monkey home page Code Monkey logo

analytics-1's Introduction

analytics

Build Status

Philosophy

Data helps us make better decisions, and the tools that enable this should be easy to understand, transparent, and fully controllable.

About

The aim of this project is to provide a lightweight, self-deployable, alternative to Google Analytics to support fast data driven decision making in a web development context. It's designed to give engineering teams an easy way to record events, pageviews, and conduct downstream analysis, like attribution modelling, A/B or MAB testing, session tracking, et cetera. All of which are possible in a ready to deploy, OSS system where you have access over the data!

Currently, this project is a work in progress, and the features currently complete are:

  • Generate UUID representing User Session and store in PostgreSQL
  • Store Page Views in PostgreSQL
  • Store Events in PostgreSQL
  • Protect Routes via API KEY
  • Javascript code to generate session
  • SQL code to intialize DB

TODO

  • Devops code for build -> TravisCI integration w/ mock test suites
  • Test environmental variables + DB setup
  • Test suite for Servant Endpoints
  • Javascript Object for session with pageview/event methods, backed up by cookie store
  • Test suite for Javascript Integration (create user session, navigate through pages, check db)
  • Support for A/B test and MAB variant assignment
  • Add top-level domain field to pageview
  • Send more tracking data from browser back to db (user agent, time zone, language, ip, et cetera)
  • Heroku Deploy for pre-existing DB
  • DB deploy script [POSIX compliant systems]

Install: Dev environment, MacOS Install Instructions

Set up Postgres

First, you need to have postgres installed and running locally. To do this, we will use the postgresql helper fns pg_ctl, create{db,user}

$ brew install postgresql
$ pg_ctl -D /usr/local/var/postgres start && brew services start postgresql
$ createdb analytics
$ createuser analytics

Run Migrations

Note: these are destructive, table destroying actions, use them only to set up the the database

$ stack build
$ source config/dev.env && stack exec -- analytics-migrations

Heroku Deploy

For the analytics server.

  1. Make sure a production DB is set up, and that the migrations/db set up have been successfully performed. This can be done by getting the prod config, and running source [production config] && stack exec -- analytics-migrations.
  2. Set up heroku project
  3. use the haskell build pack $ heroku buildpacks:set https://github.com/mfine/heroku-buildpack-stack --app {project_name}
  4. In heroku, set environment variables, API_KEY, CORS_ORIGIN, DBCONN. Note, on heroku, the environmental variable PORT has to be set by the heroku environment.
  5. on cmd line, $ heroku git:remote -a [project-name]

Local Test Env

The local tests will spin up a postgres instance, and a warp server for the sake of testing. This is designed to mock the TravisCI environment. To run the tests with the proper configuration variables set:

$ source config/test-local.env && stack test

analytics-1's People

Contributors

adamwespiser avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.