承接 datlechin/flarum-link-clicks 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

datlechin/flarum-link-clicks

Composer 安装命令:

composer require datlechin/flarum-link-clicks

包简介

Show a click count next to each link in a post.

关键字:

README 文档

README

License Latest Stable Version Total Downloads

A Flarum extension that puts a click count next to every link in a post.

Badge in a post

What it does

Every http(s) link grows a small badge once people start clicking. The badge inherits your theme and dark mode automatically. The number tells everyone reading the post how many people opened that link.

On top of the badge:

  • Popular links sidebar widget on each discussion.
  • Most clicked links widget on user profiles.
  • Live updates when flarum/realtime is installed. Badges tick up without a page reload.
  • Admin analytics with filters, CSV export, and a per-link drill-down that shows who clicked. Daily clicks chart, top domains rollup, weekday-by-hour heatmap, and a mobile / tablet / desktop split.
  • Per-discussion click stats. Mods get a "Click stats" item in the discussion controls dropdown, scoped to that thread.
  • User click trail. Drill from a clicker into every link that user has opened.
  • Webhook to forward click events. Exponential backoff retries, dedup header, and a "Send test ping" button.
  • Console tooling: backfill, counter reconcile, daily rollup, anomaly detection, weekly digest.
  • Domain blocklist and an optional confirm-before-leaving dialog for outbound clicks.
  • Privacy controls: forum-wide skip-guests, per-user opt-out, author per-post toggle, tag-level opt-out (with flarum/tags), and full GDPR export / anonymize / delete (with flarum/gdpr).
Popular links sidebar Most clicked links on profile
Popular links widget Most clicked links on user profile

Installation

composer require datlechin/flarum-link-clicks

Enable from Admin → Extensions.

Updating

composer update datlechin/flarum-link-clicks
php flarum migrate
php flarum cache:clear

Configuration

The extension page (Admin → Extensions → Link Clicks) has three tabs.

Admin analytics tab

Settings

Key Default What it does
enabled true Master switch. Off means no badges and no recording.
track_internal false Track links pointing back at the forum. Off keeps the focus on outbound traffic. Attachments are tracked regardless.
min_display_count 1 Hide the badge below this number.
honor_dnt true Skip recording when the request carries DNT: 1. The redirect still works.
skip_guests false Drop all guest clicks. Logged-in users only.
dedup_window_hours 24 A given user (or guest IP) only counts once per link in this window.
event_retention_days 90 Daily job removes click events older than this. Set to 0 to keep everything.
bot_user_agents Extra User-Agent fragments treated as bots. One per line.
tracking_params_strip Extra query params to strip before counting. One per line. Trailing * matches a prefix. Defaults already cover utm_*, fbclid, gclid, mc_*, igshid, _ga and others.
attachment_path_prefixes Extra URL path prefixes treated as attachments. One per line. /assets/files/ is built in.
domain_blocklist Hosts to skip entirely. One per line. *.example.com matches every subdomain. Posts referencing these hosts get no badge and clicks aren't recorded.
confirm_external_clicks false Show a browser confirm dialog when a reader clicks an external tracked link.
digest_enabled false Mail every administrator a plain-text summary of the past week's clicks every Monday morning.
anomaly_threshold_ratio 10 Daily anomaly check logs a warning when the past 24 hours' click volume exceeds the prior six-day average by this ratio.
anomaly_min_clicks 20 Floor below which the anomaly check is skipped, so quiet forums don't fire on every blip.

Webhook

Each recorded click is sent to your URL as a JSON POST. Toggle it on, paste a URL, optionally set a shared secret to sign the request body.

{
  "event": "click_recorded",
  "counted": true,
  "post_link": { "id": 123, "url": "https://example.com/page", "is_internal": false, "is_attachment": false, "post_id": 456, "discussion_id": 789, "clicks_count": 42 },
  "actor": { "user_id": 10, "username": "alice" },
  "ip_address": "192.168.1.1",
  "user_agent": "Mozilla/5.0 ...",
  "clicked_at": "2026-05-09T12:34:56Z"
}

actor is null for guest clicks. counted is false when the click hit a dedup or self-click rule (the badge didn't tick up). When a secret is set, the signature is sent in X-LinkClicks-Signature: sha256=<hex>, computed over the raw body. Delivery is async and retried a few times on failure.

Drill-down: who clicked this link

Permissions

Adds one permission: View link click analytics. Admins have it by default. Grant to other groups from Admin → Permissions.

Console commands

Command What it does
link-clicks:backfill Registers links from posts that existed before the extension was enabled. Safe to re-run. --chunk=N, --from-id=X.
link-clicks:reconcile Walks every tracked link and writes back any drift between the stored counter and the actual recorded events. --dry-run reports without writing. Daily-scheduled.
link-clicks:build-daily-rollup Aggregates raw events into the daily rollup table that powers the time-series chart on large forums. First run backfills from the oldest event; subsequent runs resume. --rebuild wipes and recomputes. Daily-scheduled.
link-clicks:detect-anomalies Logs a warning when the past day's click volume jumps versus the prior six-day average. Daily-scheduled.
link-clicks:purge-events Removes click events older than the retention window. Daily-scheduled.
link-clicks:send-digest Mails the weekly summary to administrators. Weekly-scheduled (Monday 06:00).

Privacy and GDPR

The extension stores the IP address and User-Agent of each recorded click. Under GDPR these are personal data. As the forum operator you're responsible for:

  • Disclosing the collection in your privacy notice.
  • Choosing a lawful basis (legitimate interest is the usual fit for engagement analytics).
  • Setting a retention window (the daily purge handles this).
  • Honouring access and erasure requests. Install flarum/gdpr to expose them automatically.

Defaults that lean toward privacy: bots are dropped, DNT: 1 is honoured, authors can't inflate their own counts, the redirect URL never contains the destination.

Sponsors

If this extension is useful to you, sponsoring on GitHub helps me keep building and maintaining open source for Flarum.

Links

datlechin/flarum-link-clicks 适用场景与选型建议

datlechin/flarum-link-clicks 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 05 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「discussion」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 datlechin/flarum-link-clicks 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 datlechin/flarum-link-clicks 我们能提供哪些服务?
定制开发 / 二次开发

基于 datlechin/flarum-link-clicks 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 56
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-08