morningman opened a new pull request, #4101: URL: https://github.com/apache/doris-website/pull/4101
## What problem does this PR solve? We want to know where new Slack members discover Apache Doris (website, docs, GitHub, LinkedIn, events, third-party posts, ...), but `doris.apache.org/slack` was a plain client-side redirect, so every click landed in Slack with no attribution at all. ## Solution Turn `https://doris.apache.org/slack` from a static redirect into a lightweight tracking page that records one event in the ASF Matomo instance this site already uses, then forwards the visitor to the real Slack invite. No backend, no new third-party analytics, and the public entry URL stays the same for every channel. ### The `/slack` page (`src/pages/slack.tsx` + `src/components/slack-redirect/`) - Reads `utm_source / utm_medium / utm_campaign / utm_content` and `document.referrer`, resolves attribution with priority **UTM > referrer > direct**, and reports a single Matomo event: `Category="Community Acquisition"`, `Action="Slack Click"`, `Name=source|medium|campaign|content` — e.g. `github|community||github_readme`, `reddit.com|referral||`, `direct|none||`. - Values are sanitised (lowercase, `[a-z0-9._-]` only, 64 chars max), so the `|` separator can never leak into a field. - Redirect timing: the event is queued with a completion callback and sent via `navigator.sendBeacon`, so the page leaves as soon as the request is handed to the browser (~0.9s when the tracker is up; matomo.js holds every request after the automatic pageview for 800ms). Resource Timing distinguishes a tracker that failed to load (ad blocker / 404 → leave immediately) from one still downloading (wait up to 1.5s), with a 2.5s hard cap. No-JS visitors are forwarded by a `<noscript>` meta refresh. The page is `noindex` and excluded from the sitemap. - The real invite URL now lives in exactly one place: `customFields.slackInviteUrl` in `docusaurus.config.js`. Rotating the invite no longer touches any content. ### In-site Slack entry points now carry UTM parameters | Entry | `utm_medium` / `utm_content` | |---|---| | Homepage hero "Join Slack" | `website` / `homepage_hero` | | Homepage community section | `website` / `homepage_community` | | Footer icon | `website` / `footer` | | Docs TOC "Chat on Slack" | `docs` / `docs_toc` | | Mascot nudge (all pages) | `docs` on docs/community pages, else `website` / `mascot_nudge` | | Community docs (en + zh-CN) | `docs` / `community_join_page`, `contribute_guide` | | 44 blog posts, 48 links | `content` / `blog_<post-file-name>` | | Release notes 3.0.0 | `docs` / `release_notes_3_0_0` | React components generate these URLs through a shared `buildSlackEntryUrl()` helper instead of hand-written strings; links stay absolute so they keep opening in a new tab as before. One stale direct `join.slack.com` invite link in a blog post was replaced as well. The naming convention for external channels (GitHub README, LinkedIn, webinars, conference QR codes, ...) is documented in `developer_docs/slack-utm-convention.md`. ## Check List - `node --test src/components/slack-redirect/slack-attribution.logic.test.js`: 12/12 pass. - `tsc` over all touched TS/TSX files: clean. - Production build spot check: `/slack/` and `/zh-CN/slack/` emit the noscript fallback, `noindex`, and the Matomo bootstrap; the sitemap no longer lists `/slack`; `plugin-client-redirects` no longer manages the route. - Headless-browser verification (dev server + the exact Matomo bootstrap the plugin injects in production, with `matomo.php` answered locally so no test data reached ASF): correct event payloads and redirect timing for tracker present / slow / blocked / 404 / absent, referrer fallback (`reddit.com|referral||`), value sanitisation, and every homepage entry point carrying its UTM parameters. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01SWLsJt9S3m6ExTP4i9waMG -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
