Skip to content
totaljsPublic

About

Visitors tracker

Resources

Stars

3 stars

Watchers

1 watching

Forks

Repository files navigation

Visitors

The visits of your websites and their banners in one app. One script on any website, made with Total.js or not, counts its visits without cookies and shows the banners of its campaigns.

Visitors starts from BannerSystem of Total.js, which stays as it is.

  • Total.js 5 (total5 beta) with the admin template
  • jComponent v20
  • No database server: the data are kept in the embedded NoSQL database of Total.js
  • Only a script on the websites: nothing to install on their servers
  • The page of the visits is made with the components of Componentator: ShareChart, TimeChart, StatsTable, RankChart, WorldMap and Heatmap

Installation

  • Install Node.js
  • Install the NPM dependencies in the app folder: $ npm install
  • Run it: $ node index.js 8000
  • Open http://localhost:8000 and sign in with the default account shown on the sign-in page, then change it in the account menu
  • Set the public address of the app in Settings (it is used by the script for websites)

Connect a website

  1. In Visitors, add the site with its domains (example.com, shop.example.com). Its subdomains count too, and www is the same domain.
  2. Place the script at the bottom of its pages, only once:
<script src="https://metrics.yourdomain.com/x.min.js" async defer></script>

That is all: the website can be made with Total.js or anything else. A website with a Content Security Policy allows the address of WebMetrics in script-src, connect-src and img-src.

The page of a site

One page, with the period (24 hours, 7 days, 30 days or 12 months) and Refresh in the top bar:

  • the visitors now and the last visit, the visits by where they come from (social networks, adverts, search engines, AI apps, other websites, direct) and the devices;
  • Sources and Statistics of the period: page views, visits, visitors, pages per visitor and load time, against the period before;
  • the last page views as they arrive: where the visit comes from or "Browsing", a mark for a new visitor, the page, the system and the browser, and a code of the visitor that changes every day (never an address);
  • a year by month: visits and visitors, page views on desktop and on phones, and where the visits of the year came from;
  • page views and visitors over time; the pages, and the websites that send visits;
  • the visitors by country on a world map (from the time zone of the browser, see Privacy);
  • the page views by day and hour, the browsers and the languages.

Single page apps count too: a new address without loading a page (history.pushState) is a new page view.

Where a visit comes from:

  • The website before (the referrer) decides: a search engine, a social network, an AI app or another website. Only the same host is the visit going on: another subdomain of the site is an arrival too.
  • The apps of social networks, messages and mail (Telegram, WhatsApp, a mail app) open a link without saying where it comes from, so the visit looks direct. Put utm_source in the links you share and it is counted where it belongs: https://example.com/?utm_source=telegram is a visit from a social network, and its name shows in the websites that send visits. Facebook and Instagram mark their links themselves (fbclid, igshid).
  • An advert is a link with a click id of an ad network (gclid, msclkid, ttclid...) or with utm_medium set to cpc, ppc, paid, ads, display, banner or cpm.

Privacy

  • No cookies and nothing stored in the browser for the visits, so the website needs no cookie banner for them.
  • A visitor is counted once a day by a hash of a secret of the day, the address, the browser and the site. The secret lives only in memory and changes every day; the address is never kept.
  • Only the domains of the sites are counted, and only from their own pages.
  • Robots that drive a browser (navigator.webdriver) are not counted.
  • The country of a visitor comes from the time zone of the browser (Europe/Madrid), turned into a country by a table inside WebMetrics (plugins/visitors/definitions/timezones.js): no address, no database of addresses and no other service. It is approximate where countries share a time zone.

Banners on a website

The same script shows banners, only where the page has the container of a banner. Place it where the banner appears (the code of each banner is in Banners, Set up a banner on your website):

<div class="x" data-id="BANNER_ID"></div>

Without it nothing changes on the page.

A campaign can choose its pages by words, searched in the address and the title of the page: the Ignore list skips the pages that contain one of the words, and the Show only list shows the campaign only on the pages that contain one of them (for example predaj, prenájom).

Extend the visits

The counting (plugins/visitors/definitions/visits.js) knows no plugin, and a plugin can add to it:

  • ON('visits_message', fn) receives every message of the script: count what you need, or a message of your own kind.
  • ON('visits_read', fn) adds your part to what is read.
  • The script for websites (plugins/visitors/x.js, served as /x.min.js): put the path of your script in MAIN.xscripts and WebMetrics adds it after the one of the visits. It gets webmetrics.send(data), webmetrics.on('view', fn), webmetrics.on('leave', fn), webmetrics.hold() and webmetrics.stop().
  • The page of a site: ON('visits_detail', function(element, id) {}) adds your buttons to its top bar.
  • The buttons of a page go in the top bar, next to the breadcrumb, with the class pin (<div class="toolbar pin">); the name of the page is in the breadcrumb.

About

Visitors tracker

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages