Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自建网页统计功能平台 #43

Open
dalaolala opened this issue Feb 26, 2022 · 1 comment
Open

自建网页统计功能平台 #43

dalaolala opened this issue Feb 26, 2022 · 1 comment

Comments

@dalaolala
Copy link
Owner

dalaolala commented Feb 26, 2022

可以用来代替百度统计或者谷歌统计

环境要求

A server with Node.js 12 or newer
A database (MySQL or Postgresql)

拉去代码并安装

git clone https://github.com/mikecao/umami.git
cd umami
npm install

新建数据并且导入数据库文件

数据库文件的目录在根目录下
sql/schema.mysql.sql

创建环境变量文件.env 写入数据库的配置

mysql://username:mypassword@localhost:3306/mydb

编译工程并启动

npm run build
npm start

问题解决

1、如果报错为如下

SWC Failed to Load  参考如下解决措施

https://nextjs.org/docs/messages/failed-loading-swc

新建 文件 .babelrc,写入下面内容,然后npm run build

{
  "presets": ["next/babel"]
}

2、pm2启动项目

pm2 start npm -- name umai -- start

3、反向代理设置

  location / { 
    proxy_pass http://127.0.0.1:3000; 
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $http_host;
   }   

4、默认的登录用户名和密码

admin /  umami

更多的内容以及参考如下

https://umami.is/docs/install

@dalaolala
Copy link
Owner Author

dalaolala commented Jun 12, 2023

Matomo 统计平台

这个统计功能更加强大,完全可以替代谷歌统计,支持私有化部署,自带的免费功能足够用

安装文档参考如下

https://matomo.org/faq/on-premise/installing-matomo/#start-the-installation

支持通过cloudflare添加统计代码
https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-tracking-code-on-my-cloudflare-setup/

几个重要的设置

设置IP地址不要为匿名

image

设置更准确的地理位置信息

根据上面的提示去指定的网站下载,然后放到对应的目录即可

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant