# Journal Analytics

> Google Analytics traffic lined up against what the team actually did

- Author: James Hong
- Tags: web, data
- Stack: jQuery, PostgreSQL, Node, Express, Passport, Mocha / Chai, Highcharts, ChartJS
- URL: https://gnohj.net/projects/journal-analytics/

Analytics shows that traffic changed, not why.
Journal Analytics closes that gap: the team logs what it did, on or off the web, from a booth at a 5K to a post syndicated across several platforms, and each entry lands on the same timeline as the [Google Analytics](https://marketingplatform.google.com/about/analytics/) traffic.
Cause and effect become something you can read off one chart.

*Image: The Journal Analytics sign-in page.*

## The main chart

Total sessions over time, with a marker on every day the team logged something.
Clicking a point opens that day's events, so a spike and its likely cause are one click apart.

*Image: The main sessions chart with event markers.*

*Image: A modal listing the events for one day.*

## Logging events

Logging has to be cheap or nobody does it, so any teammate can add an event in a few fields and review what everyone else logged over a date range.

*Image: The form for adding a team event.*

*Image: Events submitted by team members over a date range.*

## Where the traffic came from

*Image: A pie chart of events by channel.* *Image: Social network referrals for the week.*

Events broken down by channel, such as Facebook or Twitter, next to the week's social referrals, which shows whether effort and traffic come from the same place.

## Stack

[jQuery](https://jquery.com/) on the front end, an [Express](https://expressjs.com/) API on [Node](https://nodejs.org/) with [Passport](https://www.passportjs.org/) for sign-in, [PostgreSQL](https://www.postgresql.org/) for the event journal, and [Mocha](https://mochajs.org/) and [Chai](https://www.chaijs.com/) for tests.
The Google Analytics API did not support server-side use, so traffic data is fetched in the browser and reshaped for [ChartJS](https://www.chartjs.org/) and [Highcharts](https://www.highcharts.com/), which gave far more control than the built-in reports.
