- Published on
Setting Up Umami Analytics Using Supabase and Vercel
- Authors
- Name
- Rosa Tiara
Introduction
Umami Analytics
Umami is an open-source and simple web analytics software that runs on PostgreSQL and Next.js API routes. By using umami, we are able to track events, referring pages, session durations, view counts, and unique visitor counts for your website. Umami is privacy-focused and only collects the metrics you care about. Such a great alternative for Google Analytics.
Supabase
Supabase is an open-source alternative to Firebase that provides all the backend services you need to build a product!
Without further ado, let's get started!
Getting Started
Account Preparation
First of all, make sure you already have a Github, Vercel, and Supabase account.
If you've already have a Github account but don't have Vercel and/or Supabase yet, you can easily sign up to them by clicking the "Sign in with Github" button.
Setting Up A Project in Supabase
- Log in to Supabase
- Go to the main dashboard
- Click the
New Projectbutton
- Fill out the form based on your preferences and make sure you also select the closest region from your location.
-
When you're done, click the
Create new projectbutton -
While waiting for the project to be set up, go to the SQL editor section on the left side.
-
Click
New queryand then head to Umami's official Github Repository, copy, and paste the sql schema query into your newly-created query. -
Click the
RUNbutton on the right side. It should show a "Success. No rows returned" message to indicate that you ran the right query.
Effortlessly Deploying Umami on Vercel
-
Go to this link and click the blue
Deploybutton. -
Fill in the repository name, check/uncheck git repository privacy based on your preference, and click
Create. DO NOT click the Deploy button yet. -
Get back to Supabase, and go to the Settings menu.
- Click
Database, scroll down till you find theConnection stringsection, and go to theURItab.
-
Click Copy, and paste it to the
DATABASE_URLin your Vercel project configuration. Make sure to changeYOUR_PASSWORDin the URI link with the password you created for this project as shown in step 4. -
For the
HASH_SALTfield, fill it with a random string. You can also use an online tool like password generator to help you.
- Click Deploy.
Congratulations! 🥳 you have successfully deployed Umami! Now it's time for configuration and add Umami to your website.
Umami Configuration
-
Visit the deployed project and log in to Umami. Fill the username with admin and the password with umami (this is configured by default, you can change this later).
-
To change your password, go to Settings -> Profile -> click
Change password
-
Fill the current password with umami, set the new password as your preferences, and click Save.
-
To add Umami to your website, go to the
Websitesection and clickAdd website
Note: leaving the Enable share URL checked means that your website's analytics dashboard link is accessible to everyone.
- When you're done, click the
Get tracking codeicon and paste it to your website project folder. Since I'm using Next.js for my website, I paste it in the_document.jsfile (inside the<head>tag).
That's all :) You have successfully added Umami analytics to your website. Hope this helps! Cheers!