counterTown
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v157View latest version
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
-
fork this val
-
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 thewebAnalyticsMod
-
configure
mySitesConfig- find the
mySitesConfigobject - update the fields with your information
- make sure to add the URLs of the sites you want to track to the
allowedOriginsfield
- find the
-
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
- place the following script tag just before the closing
Migrated from folder: counter_town/counterTown