Readme

Counter Town

a real-time web analytics tracker and dashboard

  • easy setup
  • live analytics
  • track multiple sites from a single dashboard
  • free and fully hosted on val town

inspired by projects like Udara's Stats and Martin's GoatCounter

getting started

  1. fork this val

  2. initialize the database tables

    • the tables should initialize automatically when you first run this val
    • if you need to manually initialize, you can call the initAnalytics() function from the webAnalyticsMod
  3. configure mySitesConfig

    • find the mySitesConfig object
    • update the fields with your information
    • make sure to add the URLs of the sites you want to track to the allowedOrigins field
  4. add the tracking script to your sites

    • place the following script tag just before the closing </body> tag of each site you want to track
    <script> (function() { var script = document.createElement('script'); script.async = true; script.src = 'https://<your-username>-mysitesserver.web.val.run/trackingScript'; var firstScript = document.getElementsByTagName('script')[0]; firstScript.parentNode.insertBefore(script, firstScript); })(); </script>
    • make sure to replace <your-username> with your Val Town username
    • here's the script in my personal site
Code
HTTP
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
iamseeley-countertown.web.val.run
Updated: September 10, 2024