CSS HTML JavaScript Nginx Ruby Makefile
Latest commit 3ae04ba Feb 16, 2017 @gbinal gbinal committed on GitHub adding last bits
Permalink
Failed to load latest commit information.
_agencies Remove data urls in favor of determining everything from slugs Jan 17, 2017
_data_pages Remove data urls in favor of determining everything from slugs Jan 17, 2017
_includes Adding in GTM container for DAP code Feb 13, 2017
_layouts Adding in GTM container for DAP code Feb 13, 2017
compliance Create component.yaml Dec 8, 2016
css Fix the 404 page (#398) Oct 23, 2016
fake-data/live Finalize cloud.gov migration and restore data links (#408) Nov 29, 2016
fonts inline the google font Sep 22, 2015
images update share image Jun 16, 2016
js Remove console.log. (#439) Jan 19, 2017
sass added location data, minor visualization bug still needs to be fixed Oct 16, 2015
.about.yml adding more info Oct 17, 2016
.codeclimate.yml Add codeclimate and ESList configs Jan 19, 2017
.eslintrc.yml Add codeclimate and ESList configs Jan 19, 2017
.gitignore Deploying to cloud gov (#404) Nov 17, 2016
.travis.yml Setup continuous deploy (#436) Jan 18, 2017
404.html Finalize cloud.gov migration and restore data links (#408) Nov 29, 2016
CONTRIBUTING.md remove the 18F-specific language Jan 14, 2015
Gemfile move to bundler, rewrite docs Mar 29, 2015
Gemfile.lock Update bundled gems Jan 19, 2017
LICENSE.md list exceptions to license, linking to their licenses Jan 26, 2015
Makefile Finalize cloud.gov migration and restore data links (#408) Nov 29, 2016
README.md Remove data urls in favor of determining everything from slugs Jan 17, 2017
Staticfile Deploying to cloud gov (#404) Nov 17, 2016
_config.yml Add codeclimate and ESList configs Jan 19, 2017
_development.yml Finalize cloud.gov migration and restore data links (#408) Nov 29, 2016
_staging.yml Finalize cloud.gov migration and restore data links (#408) Nov 29, 2016
data.html move variables into includes so they don't have to be declared in new… Jun 3, 2016
index.html move charts to include and refactor layouts to use that May 26, 2016
manifest.yml Finalize cloud.gov migration and restore data links (#408) Nov 29, 2016
nginx.conf Add Cache-Control and Pragma headers Jan 27, 2017
system-security-plan.yml adding last bits Feb 16, 2017

README.md

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. bash touch _agencies/agencyx.html
  3. 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
  4. Set the required data for for the new files. (Both files need this data.) example:

    ---
    name: Agency X # Name of the page
    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`
    ---
  5. 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.