Class Details

Class localStats
Version 0.03.

localStats()
local statistics - BROWSER INTERNAL TRACKING RESPECTING USERS PRIVACY

This is a page tracker for a website.
It stores the visited pages and count of their visits in the local storage
of the webbrowser of your visitor. All Tracking data stay at the user.
It does NOT use any cookie (a cookie will be sent to the webserver).

You can understand it as a tracker that respects the users privacy.

It means:
- the owner of the website has NO control about these statistic data
- the user can delete the private data of the browser resets the counter
BUT:
as owner of a website you can
- let count the visits on the client side
- react i.e if the user visits yout page the 100th time
- let draw local statistics on users request

PROJECT HOME: https://www.axel-hahn.de/projects/javascript/localstats/
DOC: https://www.axel-hahn.de/docs/localstats/index.htm

TODO
- override default options in the constructor
- let the user skip all local trackings

Author: Axel Hahn.
Version: 0.03.
<script src="/javascript/localstats.class.js"></script>
(...)
<script>
  var oStats=new localStats();
  
  // track the request
  oStats.track();
  
  // show counter
  document.getElementById("spanCounter").innerHTML=oStats.getCountTotal();
</script>
Returns:
{localStats}

Public Methods

flush

{boolean} flush()

flush all local statistic data

Returns:
{boolean}

getCountSince

{object} getCountSince()

get date object of the first tracked visit

Returns:
{object}

getCountTotal

{integer} getCountTotal()

get count of tracked requests

Returns:
{integer}
See:
getPageCount()

getMaxCountOfAPage

{Number|Boolean} getMaxCountOfAPage()

get count of most requested page

Returns:
{Number|Boolean}
See:
getCountTotal()

getPageCount

{Number|Boolean} getPageCount()

get the count of different pages that have been requested

Returns:
{Number|Boolean}
See:
getCountTotal()

getStats

{Array} getStats()

get array of reqested pages ordered by count of requests

Returns:
{Array}

renderTopTable

{String} renderTopTable(iTop, aOptions)

get html code for a top [n] table

Parameters:
{Number} iTop
{Object} aOptions
array with options; keys are - link - create a link to a page (default: false) - showhead - show title (default: true) - showcount - show column with count (default: true) - showpercent - show column with percent (default: true) - showbar - - show column with bar (default: true)
Returns:
{String}

track

{Boolean} track()

track the the current page. it repects the values of trackQueryParams and blacklist in this._aOptions

Returns:
{Boolean}

Documentation was generated by JsDoc Toolkit 2.4.0






Copyright © 2024 Axel Hahn
project page: Axels Webseite (de)
results will be here