0
点赞
收藏
分享

微信扫一扫

搭建自己的网站统计matomo

matomo环境

  • center7.9
  • php7.4.0
  • nginx1.15
  • mysql5.7
  • 域名需要https
  • matomo最新版


matomo安装

  • 预先配置好lnmp环境
  • ​​https://builds.matomo.org/matomo-latest.zip ​​​下载解压到网站目录​​
  • 开始访问https://xxxx.com ,按照提示安装

matomo配置

  • 关闭ip暴力检测

设置-->System-->General settings

找到Login设置去掉√

搭建自己的网站统计matomo_matomo

参考:​​https://matomo.org/faq/troubleshooting/faq_32758/​​

  • 设置CORS跨域问题

设置-->System-->General settings

找到CORS设置*允许

搭建自己的网站统计matomo_替代谷歌统计_02

  • 生成安全token_auth

设置-->Personal-->Security

找打Auth tokens,开始创建,创建好记得复制记录好

搭建自己的网站统计matomo_本地统计_03


matomo使用

  • 统计使用
  • 找到ALL Websites--》Add a new website,创建新网站统计,找到JavaScript Tracking Code
  • 把以下代码放到你网站​</head> 标签前
<!-- Matomo -->
<script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//matomo.xxxx.com/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
  • api获取网站统计信息
今日访问人数
https://matomo.xxx.com/?module=API&method=VisitsSummary.getVisits&idSite=1&period=day&date=today&format=JSON&token_auth=你的token


举报

相关推荐

0 条评论