Very simple and privacy-friendly analytics

[NAME] is a very simple and primitive web analytics platform available as a self hosted app. It aims to be privacy-friendly and to be deployed on all webpages. This is achieved with javascript and pixel tracking on the client side

If you wish to self host [NAME], then you need access to PHP on the webserver. Fortunately thats the case for most. If you cannot run PHP on your server you can as easily run the script hosted by me.

It is prefered to host [NAME] on your webserver. Otherwise 20-40% of webusers will block third party scripts including [NAME] by default.

Privacy friendly

Privacy is achieved by not tracking users by not storing identifiable information. Since [NAME] does not use cookies or track users, GDPR notices and annoying cookie banners are not needed.

Sessions are tracked by using an unidentifiable hash based on ip-address, siteid, useragent and a salt. Salts are changed every two hours and then deleted and thus the hash cannot be recreated ever.

This is quite similar to other privacy oriented alternative analytics

Session tracking

[NAME] has no interest in users but only in sessions.

Pageviews are using simple, primitive and transparent javascript calls or by tracking pixel if javascript is disabled for some reason.

Client side

What gets collected on user side can be seen bellow. The interesting parts are the following:
- user agent tells us the browser and OS or even most bots
- is it a touch device (Apple uses desktop user agent for tablets)
- screen width (what type of device and )
- referer (who links to us)

On server side [NAME] tries to filter out scripts/bots by looking at missing javascript params and the number of calls/time. We only care about counting bots and not prevent them

Further we try to use sendBeacon since its more effective. If javascript is enabled we use a GET request, otherwise we just load the image descibed in noscript

If javascript does not work it could be a script or a user with javascript disabled. We dont count these and dont do more about this. Its just an analytis script

This is basicly it. Nothing more than this on the client side. The script called count.php simply stores the data and outputs a 1 pixel gif image. T

    <img  id="1px" src=""> 
    function isMobile() { 
        try{ document.createEvent("TouchEvent"); return true; }
        catch(e){ return false; } 

    var analyticsURL = '/count.php?';
    var analytics1px= analyticsURL+
        "" +                                                //Hjemmesidens id 
        "&page_url=" + encodeURIComponent(window.location.href) +     //Sidens adresse
        "&title=" + encodeURIComponent(document.title) +             //Sidens titel
        "&ref=" + encodeURIComponent(document.referrer) +           //Referrer er sidste side
        "&width=" + screen.width +                                  //Skærmbredde
        "&touch=" + isMobile();                                     //Touch device

    if (navigator && navigator.sendBeacon) {
    //Hvis Beacon. 
        analytics1px +="&b=1"; //Hvormange kan bruge sendBeacon
        { //Fallback
        analytics1px +="&b=0"; 
        <img  src="/count.php?">  

Colleted data

We are only interested in: Number of sessions, Number of visits to a particular page, Devicetypes (desktop, phones & tablets, bots), Referer information

We use the collected data to identify bots and device types. There is no interested in tracking users but sessions are tracked (Not sure this is needed)

Differences to other scripts

The script works by using Javascript to connect to a PHP script og get a 1px image on your server. The javascript retrieves som data about the useragent, url, referer, screen width and if its a touch device (LIST everything collected).

You can use Primitive analytics in three different ways

  1. Store all data on your server and use a script to summarize it. No data leaves your server. Disadvantages: difficult to detect bot traffif, cannot display multiple domain data
  2. Store data on your server but send data (anonymized) to server. You can detect bots and use same interface to view data for multiple domains.
  3. Call the tracking script on It works just like the previous option. The disadvantage is that 25-40% of users will block the script with their adblocker and your stats

No matter the option selected, you are able to ensure that collected data is anonymized and nothing that identifies a user leaves your server.

For option 1 and two to work you need to be able to run PHP scripts on your server. Nearly all webhotels allow for PHP scrips to run without any issue.


Email: [email protected]