Umami v2 introduces a redesigned schema and a number of breaking changes.
umami.js
to script.js
./api/collect
to /api/send
.umami
JavaScript object have changed. There is now a single .track()
method and a new way to send event data.
See Tracker functions for more information.TRACKER_SCRIPT_NAME
environment variable no longer appends the .js
extension to the script name. See Environment variables for more information.Due to the schema changes, your data in your v1 database needs to be converted into v2.
To assist with the migration we created a script @umami/migrate-v1-v2
that will migrate all of your data for you.
event_data
table is found populated with data, it will be renamed to v1_event_data
but not dropped.DATABASE_URL
is localhost and the migration can't connect to the database, try changing to an IP address, for example: 127.0.0.1
.There are two ways to run the migration script.
Use this method if you have terminal access to your application folder.
Make sure your application is already built. If not run yarn build
first.
cd umami
npx @umami/migrate-v1-v2@latest
Use this method if you don't have access to your application folder like when deployed to Vercel or Netlify.
git clone https://github.com/umami-software/migrate-v1-v2.git
cd migrate-v1-v2
yarn install
yarn build
Create an .env
file with the following variable defined:
DATABASE_URL={connection url}
yarn start
Go into your running Docker container. You can find the name by the output of docker ps
.
docker exec -ti -u 0 <app container name> sh
Run the migration script.
npx @umami/migrate-v1-v2@latest
When the migration is run successfully, it should look like this: