Warning
This release contains some breaking changes that require migrations, so please read these instructions carefully.
What changed:
🔥 Major updates
- Add support for UTM Term & UTM Content metrics
- Add browser and OS version metrics
- Swetrix is now more memory efficient with lots of optimisations done for our Clickhouse and Redis usage
- Added support for region and city geolocation tracking. Swetrix now ships with a DB-IP geolocation database, you can also use your own .mmdb databases by setting a new
IP_GEOLOCATION_DB_PATH
variable - Clickhouse logs are no longer removed by Swetrix and instead we strongly recommend that you tune Clickhouse with its config files. We include several configs for this, so read on to know how to enable them
- Removed
API_ORIGINS
environment variable. TheAllowed origins
setting on the project settings page should be used instead - Removed
SELFHOSTED
environment variable - Added
IS_PRIMARY_NODE
environment variable. For 99% of use cases there's no need to set up multiple API nodes, one node is capable of handling lots of traffic, so it's recommended to keep it attrue
.
🙂 Minor changes
- Redesigned notifications
- Displaying custom events metadata in session overview
- Added sorting for custom events and page-views metadata table
- Replaced blake3 session hashing with xxHash for better performance
- Removed always shown scrollbars on overflowing rows for dashboard panels
- Now you can go to user session by clicking on rows inside Live visitors dropdown
- Disable comparisons for
This hour
timebucket due to it's buggy behaviour
🔧 Fixes
- Session filters do not work properly when refreshing the page
- Fixed an issue when sometimes you could see
TypeError: Cannot destructure property 'index' of 's[0]' as it is null
errors thrown in dashboard - Session chart is not working when account timezone is not set to UTC
- User flow chart did not work properly and did not display accurate data
- Errors tracked with Swetrix were displayed in dashboard with a delay for users with timezone not set at UTC
- Geolocation tracking was not working for users who had
CLOUDFLARE_PROXY_ENABLED
variable set totrue
- Sharable link on project settings was set to swetrix.com
Upgrading to Swetrix v3.3.0 (from v3.2.x)
Important
You will need to perform a database migration. Please make sure you read these instructions through to the end to make sure you've updated properly and to avoid losing any data.
1. Added .env
file; docker-compose.yml
is now compose.yaml
We've taken a lot of feedback from the previous release into account and tried to make the self-hosted version of Swetrix easy to set up, upgrade and maintain. So some changes have been made to achieve this.
Before upgrading, you should back up your docker-compose.yml
settings, as you'll need them later.
To upgrade your configuration files, do the following:
- Go to the selfhosting repository and run the
docker compose down
command to switch off Swetrix. - Back up your
docker-compose.yml
settings somewhere else, as you will need to reuse them later on. Rungit pull
to download our latest config (if this command does not work, you can rungit checkout -- .
first, but make sure you have saved your config file, as this will undo your changes). - After you do a
git pull
, run the./configure.sh
script. It will prompt you to enter environment variables one at a time and will generate an.env
file at the end. You can edit this.env
file manually as well if required. - Run the
docker compose up -d
command. This will pull the latest Swetrix and Clickhouse releases. If you open your dashboard now, it will not work properly. This is expected as you still need to do a data migration to synchronise the new code with the database tables.
The new compose.yaml
configuration also comes with several different Clickhouse configs from us to make Swetrix work more efficiently and faster. You can also create your own configs and add them to the compose file.
2. Run database migration scripts
Warning
Please make sure you always back up your data! Especially before migrating, to prevent data loss if something goes wrong.
In order to upgrade to Swetrix v3.3.0, you will need to run database migrations scripts. We assume that you've already followed the instructions above, so your compose.yaml
file should already be set to the latest Swetrix versions and they are already installed on your machine.
To perform the migrations, you need to run the following commands in your selfhosting
folder:
docker compose exec swetrix-api node migrations/clickhouse/2024_09_10.js
docker compose exec swetrix-api node migrations/clickhouse/2024_10_15.js
docker compose exec swetrix-api node migrations/clickhouse/2024_10_20.js
docker compose exec swetrix-api node migrations/clickhouse/2024_10_25.js
docker compose exec swetrix-api node migrations/clickhouse/2024_10_26.js
docker compose exec swetrix-api node migrations/clickhouse/2024_10_27.js
docker compose exec swetrix-api node migrations/clickhouse/2024_10_28.js
docker compose exec swetrix-api node migrations/clickhouse/selfhosted_2024_10_17.js
It will perform the migrations one at a time. If you don't see any Query ERROR messages written to your console, this indicates that the migrations went well and Swetrix v3.3.0 is ready to use. You should not run this script more than once.
After performing the migrations, you can run docker compose restart
and Swetrix should be good to go!
🎉 That's it, enjoy selfhosting Swetrix! Let us know if you find any bugs or have any feedback for us and join our Discord.
Our work would not be possible without your support, and we hope you will love this release!