网站统计(Web Analytics)是分析网站数据的一种工具和方法,通过收集、测量和分析网站访问数据,帮助网站所有者和管理员了解用户行为,优化网站性能,提升用户体验。
使用网站统计工具,可以更好地了解用户行为,优化网站内容和结构,提高用户满意度和转化率。
一句话解释就是监控访问网站的客户信息,网站的摄像头
![图片[1]-自建开源免费的网站统计 Matomo - 我是Tron-我是Tron](https://www.tronlink.run/wp-content/uploads/2024/05/QQ截图20240526215814.png)
功能
- 访问量(Visits): 记录网站在特定时间内的访问次数。
- 独立访客(Unique Visitors): 记录特定时间内访问网站的独立用户数。
- 页面浏览量(Page Views): 统计用户浏览的网页总数。
- 访问路径(User Path): 分析用户在网站上的浏览路径,了解用户的行为模式。
- 页面停留时间(Time on Page): 统计用户在每个页面上停留的平均时间。
- 跳出率(Bounce Rate): 分析仅浏览一个页面后就离开网站的用户比例。
- 直接流量(Direct Traffic): 用户直接输入网址或通过书签访问网站。
- 搜索引擎流量(Search Engine Traffic): 用户通过搜索引擎查询关键词进入网站。
- 推荐流量(Referral Traffic): 用户通过其他网站上的链接进入网站。
- 社交媒体流量(Social Media Traffic): 用户通过社交媒体平台进入网站。
- 用户分布(User Distribution): 根据IP地址分析用户的地理位置,包括国家、城市等。
- 热门地区(Top Locations): 了解网站在不同地区的受欢迎程度。
- 设备类型(Device Type): 统计用户使用的设备类型,如台式机、平板电脑、手机等。
- 浏览器类型(Browser Type): 了解用户使用的浏览器种类及其版本。
- 转化路径(Conversion Path): 分析用户从首次访问到完成特定操作(如购买、注册)的路径。
- 目标达成率(Goal Completion Rate): 统计用户完成预设目标(如填写表单、订阅)的比例。
- 热门内容(Top Content): 统计最受用户欢迎的页面或文章。
- 内容互动(Content Interaction): 分析用户与网站内容的互动情况,如点赞、评论、分享等。
- 点击事件(Click Events): 记录用户点击按钮、链接等交互行为。
- 下载事件(Download Events): 统计用户下载文件的次数。
- 表单提交(Form Submissions): 分析用户提交表单的情况。
- 实时访客(Real-Time Visitors): 监控当前在线访客数量和行为。
- 实时来源(Real-Time Sources): 了解当前流量来源和访问情况。
- 关键词分析(Keyword Analysis): 统计用户通过哪些关键词访问网站。
- 页面优化(Page Optimization): 评估页面的SEO表现,提供优化建议。
自建 Matomo 优点
- 100% 数据所有权
- 隐私保护
- 产品特性
- 开源
- 灵活性
- 无数据采样
- GDPR
- Google Analytics 替代方案
官方网站:https://matomo.org
Github项目地址:https://github.com/matomo-org/matomo
教程使用基于LDNMP搭建,与宝塔搭建步骤基本一样
不像纯Docker容器化搭建,所以不会多余占用内存,就像创建了一个Wordpress一样简单
准备
- 一个解析到当前ip的域名
- 申请SSL证书
- 创建数据库并赋予权限
- 配置Nginx
按照上述文章配置即可,这里省略
上传Matomo
![图片[2]-自建开源免费的网站统计 Matomo - 我是Tron-我是Tron](https://www.tronlink.run/wp-content/uploads/2024/05/QQ截图20240526212000.png)
下载程序到网站并解压到网站根目录
官方下载地址:https://matomo.org/download/
也可以使用Github地址下载
如果你可以通过 SSH 访问服务器,从服务器直接下载。因为它速度更快
wget https://builds.matomo.org/matomo.zip && unzip matomo.zip
安装
# 报错
An error occurred
Matomo couldn't write to some directories (running as user 'www-data').
Try to Execute the following commands on your server, to allow Write access on these directories:
chown -R www-data:www-data /var/html/matomo
find /var/www/html/matomo/tmp -type f -exec chmod 644 {} \;
find /var/www/html/matomo/tmp -type d -exec chmod 755 {} \;
find /var/www/html/matomo/tmp/assets/ -type f -exec chmod 644 {} \;
find /var/www/html/matomo/tmp/assets/ -type d -exec chmod 755 {} \;
find /var/www/html/matomo/tmp/cache/ -type f -exec chmod 644 {} \;
find /var/www/html/matomo/tmp/cache/ -type d -exec chmod 755 {} \;
find /var/www/html/matomo/tmp/logs/ -type f -exec chmod 644 {} \;
find /var/www/html/matomo/tmp/logs/ -type d -exec chmod 755 {} \;
find /var/www/html/matomo/tmp/tcpdf/ -type f -exec chmod 644 {} \;
find /var/www/html/matomo/tmp/tcpdf/ -type d -exec chmod 755 {} \;
find /var/www/html/matomo/tmp/templates_c -type f -exec chmod 644 {} \;
find /var/www/html/matomo/tmp/templates_c -type d -exec chmod 755 {} \;
If this doesn't work, you can try to create the directories with your FTP software, and set the CHMOD to 0755 (or 0777 if 0755 is not enough). To do so with your FTP software, right click on the directories then click permissions.
After applying the modifications, you can refresh the page.
If you need more help, try Matomo.org.
访问 https://域名
安装,提示报错,需要设置用户组权限为 www-data
chown -R www-data:www-data /www/html/matomo
执行命令后返回浏览器
![图片[3]-自建开源免费的网站统计 Matomo - 我是Tron-我是Tron](https://www.tronlink.run/wp-content/uploads/2024/05/QQ截图20240525211820-1024x368.png)
此时再次刷新https://域名
就会出现欢迎页面,点击 下一步
如果没出现就更换浏览器访问,清除浏览器缓存,重启Nginx测试
![图片[4]-自建开源免费的网站统计 Matomo - 我是Tron-我是Tron](https://www.tronlink.run/wp-content/uploads/2024/05/QQ截图20240525212016-1024x842.png)
提示信息不用管,直接下一步就行了
![图片[5]-自建开源免费的网站统计 Matomo - 我是Tron-我是Tron](https://www.tronlink.run/wp-content/uploads/2024/05/QQ截图20240526155254.png)
输入数据库信息,数据库服务器默认127.0.0.1
是本地服务器,LDNMP好像是不能用的,所以使用了创建mysql时候设置的mysql
,数据库选择MYSQLI
![图片[6]-自建开源免费的网站统计 Matomo - 我是Tron-我是Tron](https://www.tronlink.run/wp-content/uploads/2024/05/QQ截图20240526155314-1024x270.png)
继续下一步
![图片[7]-自建开源免费的网站统计 Matomo - 我是Tron-我是Tron](https://www.tronlink.run/wp-content/uploads/2024/05/QQ截图20240526155600.png)
设置后台管理员账户,邮箱必须填写
![图片[8]-自建开源免费的网站统计 Matomo - 我是Tron-我是Tron](https://www.tronlink.run/wp-content/uploads/2024/05/QQ截图20240526155739.png)
创建一个站点 网站时区必须填写
![图片[9]-自建开源免费的网站统计 Matomo - 我是Tron-我是Tron](https://www.tronlink.run/wp-content/uploads/2024/05/QQ截图20240526155839-1024x521.png)
将JavaScript跟踪代码
复制粘贴到网站的自定义js代码处即可
![图片[10]-自建开源免费的网站统计 Matomo - 我是Tron-我是Tron](https://www.tronlink.run/wp-content/uploads/2024/05/QQ截图20240526160130-1024x723.png)
安装完成
文章版权归作者所有,未经允许请勿转载!
禁止用于商业或者非法用途,否则后果自负!
本站内容仅限用于学习目的,请您下载后尽快删除!
暂无评论内容