分析 是收集和分析有关访问者如何与您的网站互动的数据的过程。这些信息至关重要,因为它可以让您做出明智的决定来改进您的网站。
Google Analytics 是一个不错的选择,但可能存在数据隐私以及 GDPR 合规性问题。
选择分析工具时,重要的是:
Umami Analytics 检查所有这些框。
Umami Analytics 是一款简单、快速且注重隐私的工具,可让您在不损害用户隐私的情况下跟踪网站使用情况。它是 Google Analytics 的开源替代品。一大优点是 Umami 分析符合 GDPR(通用数据保护条例)。
有两种使用 UMAMI 分析的选项
在本文中,我们将探索自托管选项。我们将使用 Supabase(免费套餐)作为数据库(postgres),使用 Vercel(免费套餐/爱好计划)来托管 Umami。
让我们深入了解如何使用 Vercel + Supabase 免费自行托管 Umami 分析
编辑 db/postgresql/schema.prisma 文件(添加 directUrl)
? DATABASE_URL 与从 supabase 复制的连接 Url(在步骤 2 中)相同,但您必须在 Url 末尾添加 ?pgbouncer=true&connect_timeout=1
? DATABASE_URL 与从 supabase 复制的连接 URL 相同(在步骤 2 中),但您必须将端口从 6543 替换为 5432
雷雷
Run the following command to create a migrations directory inside with your preferred name. This example will use 01_init for the migration name:
mkdir -p prisma/migrations/01_init
Generate a migration and save it to a file using prisma migrate diff
npx prisma migrate diff \ --from-empty \ --to-schema-datamodel prisma/schema.prisma \ --script > prisma/migrations/01_init/migration.sql
Run the prisma migrate resolve command for each migration that should be ignored:
npx prisma migrate resolve --applied 01_init
This command adds the target migration to the _prisma_migrations table and marks it as applied. When you run prisma migrate deploy to apply new migrations, Prisma Migrate:
username : admin password : umami
Name : provide any name of your choice Domain : your [website](https://www.invoizly.com) domain (eg. invoizly.com)
In Next.JS projects to load a third-party script for multiple routes, import next/script and include the script directly in your layout component:
import Script from 'next/script' export default function Layout({ children, }: { children: React.ReactNode }) { return ( 81d89b5803f4382047d2a9a2fe845023 39c7e4b4f64d9aef06707b4f0d0ccadf 6ffb63ddaf21320e5768a9f5d82c36d7 {children} a9af832cc08123ff4bbc99fefcd24cf5 36cc49f0c466276486e50c850b7e4956 2546ec4c319274fba24fabf75d291e1a 5f557f62ae7ac7a14e0b1cb564790dfc ) }
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.
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.
Invoizly 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.
Cover image by Marissa Grootes on Unsplash
以上是自托管 Umami Analytics:使用 Vercel 和 Supabase 免费部署的完整指南的详细内容。更多信息请关注PHP中文网其他相关文章!