Coder Social home page Coder Social logo

pwnalytics_js's Introduction

Pwnalytics is an open-source Web analytics solution. This project contains the
two JavaScript pieces loaded by Website users.


REQUIREMENTS

The Pwnalytics JS has been tested and works against the following browsers:
* Chromium / Google Chrome 6.0+
* Firefox 3.6+
* Mobile Safari in iOS 3+
* Internet Explorer 6+

Patches for extending compatibility are always welcome.


USAGE

The deployment process is heavily inspired from Google Analytics. Tracked pages
should include the script in bin/insert.min.js in a
<script type="text/javascript"> tag at the end of their <head> tag. Find/replace
the following strings:
* AA123456 -- the property ID
* bin/p.min.js -- a URL that serves the main JS file at bin/p.min.js

The analytics server should serve bin/p.min.js, after find-replacing the
following:
* bin/p.gif -- URL that receives GETs with analytics data

The analytics server should serve bin/p.gif in response to analytics data GETs,
to keep browsers happy.

The analytic data GETs parameters follow these conventions:
* __ is the event name ('page' is a pageview, everything else is user-defined)
* Params that start with __ are session parameters
** __pid is the property ID
** __uid is a user ID that persists across visits from the same browser
* All other params are user-defined.

The client-side JavaScript is provided the following API for posting analytics
data to the server.
* _paq.push('eventName') sends an event with nothing but a name
* _paq.push(['eventname', {param: 'value'}]) sends an event with metadata
* _paq.push(function() { ... }) calls a function after Pwnalytics is loaded
* _paq.push({property: 'value'}) sets a session property
* _paq.length counts events posted by _paq.push but not processed by the server

After Pwnalytics is loaded, _paq is extended with a few more features. These
should always be used in a function passed to _paq.push, to ensure that
Pwnalytics has loaded.
* _paq.reset() resets the session; the user UID will change as a consequence


BUILDING

Pwnalytics requires RubyGems, Jasmine, and Juicer with the YUI Compressor and
JSLint extensions. Once dependencies are installed, the following command will
build and test both the development and production versions of the library. 

    rake

The dependencies can be downloaded from the following locations:
* RubyGems -- http://rubygems.org/ 
* Jasmine -- gem install jasmine
* Juicer -- gem install juicer
* Juicer extensions -- juicer install jslint; juicer install yui_compressor


TESTING

Testing is fully automated using Jasmine. All patches should add tests for the
changed functionality in the spec/ directory.

For maximum iterating speed, keep a Jasmine testing server running.

1. Start the server by running

    rake jasmine

2. Make some changes to the source code, then rebuild

    rake build
    
3. Load or refresh http://localhost:8888 in your browser.

pwnalytics_js's People

Contributors

pwnall avatar

Stargazers

Mohsen F. avatar Jonathan Gottfried avatar Ying Yin avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

jonmarkgo

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.