Coder Social home page Coder Social logo

shannonmatloob / ping Goto Github PK

View Code? Open in Web Editor NEW

This project forked from parkr/ping

1.0 1.0 0.0 212 KB

:bar_chart: Your very own Google Analytics replacement, without all of the Google. Simple as pie.

Home Page: http://parkermoore.de/ping/

License: MIT License

Shell 1.04% Go 94.69% Makefile 2.41% Dockerfile 1.86%

ping's Introduction

ping

Your very own Google Analytics replacement, without all of the Google. Simple as pie.

Motivation

Google Analytics is creepy. It knows where you are, what computer you're using, what browser you're using, what page you visited, and so on. It has horizontal data for IP addresses, so Google knows what sites you've visited across the Internet, for how long, and what your path was. I'm uncomfortable giving Google all this data. In fact, I even wrote a blog post about how to block the various tracking services.

But, I wanted to know what my "greatest" hits are. I wanted to see what people liked and didn't like. Using Google Anayltics isn't an option, but what about using something much simpler? Enter: ping.

Ping: What It Is

Ping is a tiny little server that logs three things:

  • IP address of visitor
  • URL they visited
  • When the visit happened

A single tiny JavaScript file that the user requests sends down these three things and that's all there is to it. As unintrusive as possible, while still providing insight into the site's strenghts.

It also respects the Do Not Track header, which many browsers now allow users to set for all requests. Complying with this header is not mandatory, but aligns nicely with our motivation for respecting users' privacy when they ask for it.

Installation

Want to run ping? No problem.

$ go get github.com/parkr/ping
$ PING_DB=./ping_production.sqlite3 ping -http=:8972

Specify a port (defaults to 8000) and a database URL and you're off to the races. Enjoy!

Running behind a proxy? No problem. Specify PING_PROXIED=true when invoking ping and you're good to go.

Prefer Docker? We got that too!

$ mkdir data
$ docker run --rm \
  -e PING_DB=/srv/data/ping_production.sqlite3 \
  -v $(pwd)/data:/srv/data:rw \
  parkr/ping \
  ping -http=:8972

This will save all data to the specified sqlite3 database, mounted to the container and written back to the host.

Then, load the script on your pages in the HTML:

<script src="https://domain.for.ping.server/ping.js" type="text/javascript"></script>

Every page will load this /ping.js path from the ping server and will log the result to your sqlite3 database in the visits table.

If you set the -hosts flag for the ping executable, you can limit which hostnames will be logged. This is a security feature to ensure your sqlite3 database doesn't bloat with unwanted data from sites you don't want to track. For example, adding the flag -hosts=example.com,my-site.com,mysite.rocks will only log visits to your database for visits to example.com, my-site.com, and mysite.rocks. Of course, these sites have to load the javascript path as specified above, so this will only work for sites you control.

ping's People

Stargazers

 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.