Giter Club home page Giter Club logo

lophper's Introduction

lophper

Privacy Aware GDPR-Conform Low-(Level|Maintence|Data|Impact) PHP (Track|Counter|Logg)er

The Problem

Counters aim to count how often a page is visited. It is interesting to know how many new users are there. And how many *re-*users are there.

This is usually solved by Cookies or similar technologies. But it has privacy implications and requires the users consent (GDPR).

For simple Web-Applications with no desire to monetize, this is too much trouble.

The Solution

Disitinguishing (Re-)Visitors

Lopher uses plain old HTTP-Caching in order to find out if a user was there before.

The App sends a log request to the API. On the first visit the Answer is a simple 200 OK response, with a Last-Modified header. The API increases the counter. On consectuive calls, the Browser sends the If-Modified-Since header. The API responses with 304 Not Modified and may increase a revisit counter.

There can be different log events (index page, about page, click on button) and cycles (once, daily, monthly).

Counter-Storage

There must be some kind of persistant storage on the server. There are many ways: Log-Files with time-stamps, Session-Storage, Databases. Lopher uses an approach, were statistics are available by looking at the file-system: Each log increases the size of a file by one byte.

  • {event}/once/{YYYY}-{MM}/{day}
  • {event}/once-revisit/{YYYY}-{MM}/{day}
  • {event}/daily/{YYYY}-{MM}/{day}
  • {event}/daily-revisit/{YYYY}-{MM}/{day}
  • {event}/monthly/{YYYY}-{MM}/{day}
  • {event}/monthly-revisit/{YYYY}-{MM}/{day}

By looking at the files size it is for example possible to tell how many first visitors were there at this day.

There are 3 types of cycles:

  1. once
  2. daily
  3. monthly

The content of the files is not just a dummy byte, but a specific value.

  1. once: day of month
  2. daily: hour of day
  3. monthly: day of month

lophper's People

Contributors

htho 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.