<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: The Codesmith</title>
    <description>The latest articles on DEV Community by The Codesmith (@the_codesmith_fa48a404bea).</description>
    <link>https://dev.to/the_codesmith_fa48a404bea</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1910133%2F94f9ee6b-8bd2-4e95-80b8-0676d7d93783.png</url>
      <title>DEV Community: The Codesmith</title>
      <link>https://dev.to/the_codesmith_fa48a404bea</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/the_codesmith_fa48a404bea"/>
    <language>en</language>
    <item>
      <title>Self-Hosting Umami Analytics: A Complete Guide to Deploying with Vercel and Supabase for Free</title>
      <dc:creator>The Codesmith</dc:creator>
      <pubDate>Sat, 10 Aug 2024 12:54:34 +0000</pubDate>
      <link>https://dev.to/the_codesmith_fa48a404bea/self-hosting-umami-analytics-a-complete-guide-to-deploying-with-vercel-and-supabase-for-free-3945</link>
      <guid>https://dev.to/the_codesmith_fa48a404bea/self-hosting-umami-analytics-a-complete-guide-to-deploying-with-vercel-and-supabase-for-free-3945</guid>
      <description>&lt;h3&gt;
  
  
  What is Analytics
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Analytics&lt;/strong&gt; is the process of collecting and analyzing data about how visitors interact with your website. This information is crucial because it allows you to make informed decisions to improve your website.&lt;/p&gt;

&lt;p&gt;Google Analytics is a great choice but there could be data privacy as well as GDPR compliance concerns.&lt;/p&gt;

&lt;p&gt;When choosing an analytics tool, it's important that it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;is free (open source)&lt;/li&gt;
&lt;li&gt;allows self hosting (no vendor lock in)&lt;/li&gt;
&lt;li&gt;is GDPR compliant&lt;/li&gt;
&lt;li&gt;is light weight &amp;amp; fast&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Umami Analytics checks all these boxes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Umami Analytics : An open source analytics solution
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://umami.is/docs" rel="noopener noreferrer"&gt;Umami Analytics&lt;/a&gt; is a simple, fast, and privacy-focused tool that lets you track website usage without compromising user privacy. It is an open-source alternative to Google Analytics. A big plus is that Umami analytics is GDPR (General Data Protection Regulation) compliant.&lt;/p&gt;

&lt;p&gt;There are two options to use UMAMI analytics&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;use UMAMI cloud solutions (paid with free tier plan)&lt;/li&gt;
&lt;li&gt;Self host on your server&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this article we are going to explore self hosting option. We are going to use Supabase (free tier plan) for database (postgres) and Vercel (free tier/hobby plan) for hosting Umami.&lt;/p&gt;

&lt;p&gt;Let us dive into how to self host Umami analytics using Vercel + Supabase for free&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Create new project in Supabase
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create a new account (if you don’t already have one) with Supabase and create new project by pressing &lt;code&gt;+ New Project&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Provide project name as you like (eg. &lt;code&gt;your_app_name-analytics&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Don’t forget to store password somewhere, it would be needed later.&lt;/li&gt;
&lt;li&gt;Select a region nearest to the location of hosting server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp5dj04ul4rypmb28z5qc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp5dj04ul4rypmb28z5qc.png" alt="Image description" width="800" height="356"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Initial Configuration for Supabase
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Select the project, navigate to SQL editor&lt;/li&gt;
&lt;li&gt;Copy the SQL scripts provided in the &lt;a href="https://github.com/umami-software/umami/blob/master/db/postgresql/migrations/01_init/migration.sql" rel="noopener noreferrer"&gt;github&lt;/a&gt; repo&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvaw2qis9scd6e34l735t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvaw2qis9scd6e34l735t.png" alt="Image description" width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Paste it on the SQL editor and click on run&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4izzs702ku54zxsekb1t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4izzs702ku54zxsekb1t.png" alt="Image description" width="800" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You’ll be able to see newly created tables on &lt;code&gt;Table Editor&lt;/code&gt; option&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F64h94pftyga2usvy4c33.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F64h94pftyga2usvy4c33.png" alt="Image description" width="800" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to Project Settings → Database → Connection String → Copy Connection URL&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbd3dwj97sg6ed9q27lv8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbd3dwj97sg6ed9q27lv8.png" alt="Image description" width="800" height="388"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Fork UMAMI on github
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Fork the &lt;a href="https://github.com/umami-software/umami" rel="noopener noreferrer"&gt;https://github.com/umami-software/umami&lt;/a&gt; project to your GitHub account.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Edit &lt;code&gt;db/postgresql/schema.prisma&lt;/code&gt; file  (add directUrl)&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;datasource&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;provider&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;postgresql&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="nx"&gt;url&lt;/span&gt;          &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;DATABASE_URL&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="nx"&gt;directUrl&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;DIRECT_DATABASE_URL&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;//add this line&lt;/span&gt;
  &lt;span class="nx"&gt;relationMode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;prisma&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Deploy on Vercel
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Go to Dashboard on Vercel and create new project&lt;/li&gt;
&lt;li&gt;From the dashboard page click Import Project then specify the URL to your fork of the project on GitHub.&lt;/li&gt;
&lt;li&gt;Before clicking on Deploy add the following environment variables
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;DATABASE_URL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;postgres&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//[user]:[password]@aws-0-[aws-region].pooler.supabase.com:6543/postgres?**pgbouncer=true&amp;amp;connection_limit=1**&lt;/span&gt;
&lt;span class="nx"&gt;DIRECT_DATABASE_URL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;postgres&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//[user]:[password]@aws-0-[aws-region].pooler.supabase.com:**5432**/postgres&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Important!!
&lt;/h3&gt;

&lt;p&gt;💡 DATABASE_URL is same as the Connection Url copied from supabase (in step 2) but you have to add &lt;strong&gt;&lt;code&gt;?pgbouncer=true&amp;amp;amp;connect_timeout=1&lt;/code&gt;&lt;/strong&gt; at the end of Url&lt;/p&gt;

&lt;p&gt;💡 DATABASE_URL is same as the Connection Url copied from supabase (in step 2) but you have to replace the port from &lt;code&gt;6543&lt;/code&gt; to &lt;code&gt;5432&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After that click on deploy&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Resolving Error “The database Schema is not empty”
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;In step two we did run a sql script in Supabase which created few tables in the database. Now when script is run during deployment it throws an error with error code &lt;code&gt;P3005&lt;/code&gt; saying &lt;code&gt;Database schema is not empty&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;To resolve this, clone your forked repository in your local and add the same environment variables as mentioned above (in step 4)&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now run the following commands (to install dependencies and setup db connection)&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn install
yarn build-db
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then we would create a &lt;a href="https://www.prisma.io/docs/orm/prisma-migrate/workflows/baselining" rel="noopener noreferrer"&gt;baseline migration&lt;/a&gt; by following below steps&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;If you have a prisma/migrations folder, delete, move, rename, or archive this folder.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run the following command to create a &lt;code&gt;migrations&lt;/code&gt;         directory inside with your preferred name. This example will use         &lt;code&gt;01_init&lt;/code&gt; for the migration name:&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir -p prisma/migrations/01_init
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Generate a migration and save it to a file using &lt;code&gt;prisma migrate diff&lt;/code&gt;&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx prisma migrate diff \
--from-empty \
--to-schema-datamodel prisma/schema.prisma \
--script &amp;gt; prisma/migrations/01_init/migration.sql
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run the &lt;code&gt;prisma migrate resolve&lt;/code&gt; command for each migration that should be ignored: &lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx prisma migrate resolve --applied 01_init
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This command adds the target migration to the &lt;code&gt;_prisma_migrations&lt;/code&gt; table and marks it as applied. When you run &lt;code&gt;prisma migrate deploy&lt;/code&gt; to apply new migrations, Prisma Migrate:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Skips all migrations marked as 'applied', including the baseline migration&lt;/li&gt;
&lt;li&gt;Applies any new migrations that come after the baseline migration&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;You will be able to successfully deploy the app on Vercel server after this. The URL of your analytics app would be available under &lt;code&gt;project&lt;/code&gt; tab of Vercel app.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  6. Login to Umami
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The default credentials for login is
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;username : admin
password : umami
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;To change the default credentials navigate to settings → users → admin → edit&lt;/li&gt;
&lt;li&gt;Enter your new password and click on save.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  7. Configure your website for analytics tracking
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;navigate to settings → websites → &lt;code&gt;+ Add website&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Name : provide any name of your choice
Domain : your &lt;span class="o"&gt;[&lt;/span&gt;website]&lt;span class="o"&gt;(&lt;/span&gt;https://www.invoizly.com&lt;span class="o"&gt;)&lt;/span&gt; domain &lt;span class="o"&gt;(&lt;/span&gt;eg. invoizly.com&lt;span class="o"&gt;)&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flnyy8a4x5k80gal5xipc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flnyy8a4x5k80gal5xipc.png" alt="Image description" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once website is added navigate to settings → website → your website name → edit → tracking code. Copy the tracking code.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  8. Add tracking code to your project
&lt;/h3&gt;

&lt;p&gt;In Next.JS projects to load a &lt;a href="https://nextjs.org/docs/app/building-your-application/optimizing/scripts" rel="noopener noreferrer"&gt;third-party script&lt;/a&gt; for multiple routes, import &lt;code&gt;next/script&lt;/code&gt; and include the script directly in your layout component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Script&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;next/script&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Layout&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;children&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ReactNode&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;html&lt;/span&gt; &lt;span class="na"&gt;lang&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"dark"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;cn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;inter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; antialiased`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Navbar&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Footer&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Script&lt;/span&gt; 
          &lt;span class="na"&gt;defer&lt;/span&gt; 
          &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"https://[your-analytics-app].vercel.app/script.js"&lt;/span&gt; 
          &lt;span class="na"&gt;data-website-id&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"xxxx-xxx-xxxx-xxxx-xxxxx"&lt;/span&gt; 
        &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After adding the Sript in your root layout, deploy your app and visit your web page. you will be able to track the visits on your analytics dashboard page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqyn9z5th29moklltqxvv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqyn9z5th29moklltqxvv.png" alt="Image description" width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Hope with help of this article you will be able to set up analytics for your application quickly and easily, without relying on third-party services. Since Vercel and Supabase both provides generous free tier, you can run your analytics for free in the initial days while being GDPR compliant.&lt;/p&gt;

&lt;h2&gt;
  
  
  About Invoizly
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://invoizly.com/" rel="noopener noreferrer"&gt;Invoizly&lt;/a&gt; is all about making invoicing easy and free. With Invoizly, you can quickly create high-quality, customizable invoices that look professional. It’s designed to be super user-friendly, so you can focus on your business instead of getting bogged down in paperwork.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Cover image by &lt;a href="https://unsplash.com/@marissacristina?utm_content=creditCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=unsplash" rel="noopener noreferrer"&gt;Marissa Grootes&lt;/a&gt; on &lt;a href="https://unsplash.com/photos/text-H5NyZVLlJFI?utm_content=creditCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=unsplash" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>vercel</category>
      <category>analytics</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
