GithubHelp home page GithubHelp logo

umami-api's Introduction

UMAMI-API 📊

对于只有前端的网站,直接通过 npm 部署 Umami API 会暴露 Umami 的账号密码,通过 vercel 部署或许安全一点。

vercel 自建 API 方法

  1. FORK

  2. vercel 中添加新项目,并关联 FORK 的库

  3. vercel 项目设置中添加环境变量:

  • UMAMI_APP_URL : umami 服务的 url,不需要 http/https

  • UMAMI_APP_USERNAME : umami 服务的登录用户名

  • UMAMI_APP_PASSWORD :umami 服务的登录密码

  • UMAMI_WEBSITEUUID : 被监控网站的 WebsiteUuid

    • WebsiteUuid 获取: 打开你的 umami,进入监控网站的详情页

      image /websites/ 后的就是 WebsiteUuid

  • TIME_PERIOD:

    • 1day 一天内的数据 / 1hour / 1week / 1month
  1. 重新部署 Redeploy vercel 项目

使用

访问 vercel 网址会返回 "hello world"

image

访问 网址下 api/getEvents 返回 umami 事件统计数据,数据形式取决于收集数据的方式:

image

其他 api 接口可以参照 getEvents.js 自行添加

缺点:TIME_PERIOD 时间最长只能设置一个月

Docker 部署版本

查看 docker 分支

参考

基于 npm 包: Umami API Client

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.