A Micro Micro CMS

Visitor tracking

Relevant files:

/inc/ (folder)
    /inc/tracking.php
    /inc/tracking-default.php
    /inc/tracking-not-activated.php

/visits/ (folder)
    /img/count.txt
    /img/index.php
    /img/listhits.txt
    /img/since.txt
    /img/stylesheet.css


From September 2020 a simple visitor tracking system is included. The tracking file is /inc/tracking.php. By default it is not active (not tracking hits). To make visitor tracking active, save /inc/tracking-not-activated.php (or re-name it) as /inc/tracking.php.

The most recent 200 visits can then be viewed by entering the password "v" on:

yoursite.com/visits/

This only a simple view of what is going on. If you are logged out of admin it will include your own visits as well. A much more comprehensive report can be produced with Google Analytics. This involves creating an account with Google and obtaining a 'site tag' which you can add to /inc/tracking.php by replacing:

<!-- Global site tag (gtag.js) (Google Analytics if required) //-->

with the code you obtain from Google – something like:

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-00000000-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-00000000-1');
</script>

There is a learning curve if you have never used Google Analytics but the information provided about the activity on your website is very comprehensive.


Remove visitor tracking

To restore visitor tracking to a non-active state, save /inc/tracking-default.php (or re-name it) as /inc/tracking.php. Nothing will then be tracked.

Page last modified: 01 September, 2020