重置网页阅读量数据

万象更新

近期准备把网站用到的所有 API 接口都用 serverless 重新部署。查询了一圈发现 Deta.sh 的 Micros 在调用量和流量上几乎没有限制,所以转到 Deta Micros 作为主要的阵地,部分也使用了 Cloudflare Workers。国内大厂的话还是推荐百度智能云的云函数,毕竟良心地给了 1 GB 的出口流量~

原本想用 MongoDB 作为数据库练练手的,但是 Micros 目前不支持连接 MongoDB,只能作罢 🤣

Deta 也提供了 Base 数据库 (NoSQL),并且容量和读写次数都不限 👍️,在同一平台上运行,理当性能是不错滴。所以也把之前放在 Google Firestore 上的网页访问量数据库也挪到 Deta Base 上来了。

因为懒嘛,没做数据迁移,直接舍弃了之前的数据,从零开始计数了。之前从 LeanCloud 迁移到 Firestore 也没有保留数据,真是懒呀 😴

粗略的搭建过程见 Building a pageview counter with Deta.sh Micros and Base database 💯

此外,我还发现了一个很好用的浏览量统计系统,GoatCounter,免费版提供 100k pageviews/month,支持自定义域名,也有 API 返回统计数据,还支持公开数据统计页面。对博客网站来说,完全可以用来替代 GA4 这些 👍️

PPS,https://pixe.la 这个非常适合用来做数据统计嘛,反正也是要在 Micros 中写入数据库的,也顺道把数据推送到 Pixe Graph 中,下面就是实时的 Graph…

inDev. Journal pageviews, by Pixe.la

最近疫情反反复复,大家注意防护 😷, 祝大家安康!💪

林宏

Frank Lin, PhD

Hey, there! This is Frank Lin (@flinhong), one of the 1.41 billion . This 'inDev. Journal' site holds the exploration of my quirky thoughts and random adventures through life. Hope you enjoy reading and perusing my posts.

YOU MAY ALSO LIKE

Automatically purge Cloudflare cache after Netlify build

Tutorials

2020.05.15

Automatically purge Cloudflare cache after Netlify build

Although Netlify provides CDN service, Cloudflare has more edge locations around the world. What's more, Netlify hosted sites are hardly reached in China, while Cloudflare still lives. With this in mind, I decided to switch to Cloudflare for load balancing. However, pushing post/file changes to Netlify did not clear Cloudflare's cache, that's a mess. So, I'm going to use Cloudflare's API together with Netlify's outgoing webhook to make them in the same pace.

Setup Google Analytics 4 with GTM

Tutorials

2020.11.22

Setup Google Analytics 4 with GTM

Google Analytics 4 is Google's newest version of Google Analytics. Since I'm using the Google Tag Manager, just take a few steps to set up GA4 for my site.

Ads by Google