Coder Social home page Coder Social logo

changliwei / analytics.usa.gov Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 18f/analytics.usa.gov

0.0 1.0 0.0 2.22 MB

The US federal government's web traffic.

Home Page: https://analytics.usa.gov

License: Other

HTML 14.44% Ruby 2.04% Makefile 0.33% CSS 55.10% JavaScript 28.09%

analytics.usa.gov's Introduction

analytics.usa.gov

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

Setup

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

Install them all:

bundle install

Developing locally

Run Jekyll with development settings:

make dev

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

Sass can watch the .scss source files for changes, and build the .css files automatically:

make watch

To compile the Sass stylesheets once, run make clean all, or make -B to compile even if the .css file already exists.

Developing with local data

The development settings assume data is available at http://localhost:3000.

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 production

In production, the site's base URL is set to https://analytics.usa.gov and the data's base URL is set to https://analytics.usa.gov/data/live.

To deploy this app to analytics.usa.gov, you will need authorized access to 18F's Amazon S3 bucket for the project.

To deploy the site using s3cmd, production settings, and a 5 minute cache time, run:

make production && s3cmd put --recursive -P --add-header="Cache-Control:max-age=300" _site/* s3://18f-dap/

Use the full command above. The full command ensures that the build completes successfully, with production settings, before triggering an upload to the production bucket.

Fixing links in the Top 20

Links pulled directly from Google Analytics are occasionally broken (this is most common in the Top 20 section). For now, we're hard coding the fix in the index.js file here in the format: "broken link" : "working link",.

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

audiodude avatar cew821 avatar gbinal avatar konklone avatar leahbannon avatar ramirezg avatar rypan avatar shawnbot avatar tdlowden avatar therealphildini avatar waldoj avatar

Watchers

 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.