Giter Club home page Giter Club logo

analytics.usa.gov's Introduction

Code Climate Build Status Dependency Status

analytics.usa.gov

A project to publish website analytics for the US federal government.

For a detailed description of how the site works, read 18F's blog post on analytics.usa.gov.

Other organizations who have reused this project for their analytics dashboard:

This blog post details their implementations and lessons learned.

Setup

Ths app uses Jekyll to build the site, and Sass, Bourbon, and Neat for CSS.

Install them all:

bundle install

analytics-reporter is the code that powers the analytics dashboard. Please clone the analytics-reporter next to a local copy of this github repository.

Adding Additional Agencies

  1. Ensure that data is being collected for a specific agency's Google Analytics ID. Visit 18F's analytics-reporter for more information. Save the url path for the data collection path.
  2. Create a new html file in the _agencies directory. The name of the file will be the url path.
touch _agencies/agencyx.html
  1. Create a new html file in the _data_pages directory. Use the same name you used in step 2. This will be the data download page for this agency
touch _data_pages/agencyx.html
  1. Set the required data for for the new files. (Both files need this data.) example:
---
name: Agency X # Name of the page
data_url: https://analytics.usa.gov/data/agencyx # Data URL from step 1
slug: agencyx # Same as the name of the html files. Used to generate data page links.
layout: default # type of layout used. available layouts are in `_layouts`
---
  1. Agency page: Below the data you just entered, include the page content you want. The _agencies page will use the charts.html partial and the _data_pages pages will use the data_download.html partial. example:
{% include charts.html %}

Developing locally

Run Jekyll with development settings:

make dev

(This runs bundle exec jekyll serve --watch --config=_config.yml,_development.yml.)

Developing with local data

The development settings assume data is available at /fakedata. You can change this in _development.yml.

Developing with real live data from analytics-reporter

If also working off of local data, e.g. using analytics-reporter, you will need to make the data available over HTTP and through CORS.

Various tools can do this. This project recommends using the Node module serve:

npm install -g serve

Generate data to a directory:

analytics --output [dir]

Then run serve from the output directory:

serve --cors

The data will be available at http://localhost:3000 over CORS, with no path prefix. For example, device data will be at http://localhost:3000/devices.json.

Deploying the app

To deploy to analytics.usa.gov after building the site with the details in _config.yml:

make deploy_production

To deploy to analytics-staging.app.cloud.gov after building the site with the details in _config.yml and _staging.yml:

make deploy_staging

Environments

Environment Branch URL
Production master https://analytics.usa.gov
Staging master https://analytics-staging.app.cloud.gov

Public domain

This project is in the worldwide public domain. As stated in CONTRIBUTING:

This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.

All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.

analytics.usa.gov's People

Contributors

konklone avatar gbinal avatar cew821 avatar hbillings avatar juliawinn avatar tdlowden avatar shawnbot avatar leahbannon avatar geramirez avatar arctansusan avatar bchartoff avatar stvnrlly avatar dlapiduz avatar andrewhughey avatar davidascher avatar ramirezg avatar thekaveman avatar therealphildini avatar rogeruiz avatar rypan avatar audiodude avatar allejo avatar waldoj avatar wslack avatar brendansudol avatar

Watchers

James Cloos avatar KeunSuLee 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.