Self-hosted analytics on shared hosting: what you need and how to set it up
Run your own web analytics on ordinary PHP shared hosting: the requirements, a step-by-step install, a cron job, updates and backups, with no server skills needed.
Run your own web analytics on ordinary PHP shared hosting: the requirements, a step-by-step install, a cron job, updates and backups, with no server skills needed.
Most guides to self-hosted analytics assume you have a server, a container runtime and a free evening. But plenty of sites live on cheap shared hosting, with a control panel, an FTP login and nothing else. The good news is that you can run your own analytics there too, as long as you pick a tool built for it.
This guide walks through a typical setup with Tidemark, which is designed for PHP shared hosting, but the checklist applies to any PHP-based analytics tool.
stats.yourdomain.com.You do not need SSH, Node.js, Docker or Composer.
In your hosting control panel, add a subdomain such as stats.yourdomain.com and note its document root folder. If your host lets you, point the document root at the public folder of the app after you upload it. If it does not, the release includes a root .htaccess that forwards requests to public/ and blocks the internal folders, so uploading to the web root as-is still works.
Download the latest tidemark-x.y.z.zip from the releases page (dependencies are already bundled), upload it with the file manager or FTP, and unzip it in the subdomain’s folder.
Open https://stats.yourdomain.com/install. The installer checks your server, connects a database (choose SQLite if you want zero setup), runs the migrations and creates your admin account. When it finishes you are signed in.
Add the domain you want to measure and copy the snippet into the <head> of every page:
<script defer data-domain="yourdomain.com"
src="https://stats.yourdomain.com/js/script.js"></script>
The dashboard waits for the first page view and then opens by itself. If you use a CDN or proxy, real visitor addresses and countries are read from its headers.
Two features need a scheduled task: buffering events through a queue, and automatic deletion of old data. In your host’s cron settings add one entry that runs every minute:
* * * * * php /home/you/stats/artisan schedule:run >> /dev/null 2>&1
If you do not use those features, you can skip it. The cron guide has the details.
Password resets and invitations need working outgoing mail. Add your host’s SMTP settings as described in the email guide. Without it the app still works, it just cannot send emails.
Administrators can update from Account settings, which downloads the release, makes a backup of the current files, applies it and runs the database migrations the first time you open the dashboard afterwards. If your host blocks the updater from writing files, upload the new release over FTP instead. See the updating guide.
With SQLite, your whole database is one file, so backing up is a copy. Back up the .env file as well, because it holds the app key. With MySQL, MariaDB or PostgreSQL, use your host’s backup tool or a database dump. The backups guide lists exactly what to keep.
storage is not writable. The storage and bootstrap/cache folders must be writable by PHP.Self-hosting is one option, not the only one. You can start free on Tidemark Cloud with the same dashboard and move to your own server later: exporting a site from one and importing it into the other is a download and an upload. The self-hosted tools guide compares the alternatives if you want to look at other options first.