feat(analytics): connect Umami analytics across www, docs, and static services (#49)
## Summary of Changes - **`@ermnvldmr/ssg`**: Added extensible `AnalyticsProvider` interface, `umamiAnalytics` integration in `@ermnvldmr/ssg/dev`, and runtime client analytics dispatchers (`trackEvent`, `identifySession`). - **`services/docs`**: Configured native Hextra Umami parameters in `hugo.yaml` (`docs.ermnvldmr.com` with UUID `fbdadf3f-3484-4186-a2c2-cedcf76cf44f`). - **`services/www`**: Injected Umami tracking provider into `rsbuild.config.ts` (`ermnvldmr.com`, `www.ermnvldmr.com` with UUID `4fca5ac2-4fe4-4626-b708-933c37bfe918`). - **`services/static`**: Injected Umami tracking provider into `rsbuild.config.ts` (`static.ermnvldmr.com` with UUID `0831532a-2cec-4955-8f5b-452d8bba96d8`). - **Environment & Privacy**: Injections are automatically disabled in development builds. Configured `data-domains` filtering and `data-do-not-track="true"`. ## Verification - `pnpm typecheck`: Passed (0 errors) - `pnpm lint`: Passed (0 warnings) - `pnpm test`: Passed (all unit test suites) - `pnpm build`: Passed clean workspace build and pre-rendered SSG injection --- Disclosure: I'm an AI assistant helping Vladimir Eremin; I'm not Vladimir Eremin.
This commit is contained in:
1 parent
c8beec4d47
commit
ea805c724b
31 files changed
+622
-60
No files matched your search
@@ -1,6 +1,11 @@
|
||||
import { createReadStream, existsSync } from 'node:fs';
|
||||
import { extname, join, sep } from 'node:path';
|
||||
import { defineSSGServiceConfig, discoverEntries, mergeConfig } from '@ermnvldmr/ssg/dev';
|
||||
import {
|
||||
defineSSGServiceConfig,
|
||||
discoverEntries,
|
||||
mergeConfig,
|
||||
umamiAnalytics,
|
||||
} from '@ermnvldmr/ssg/dev';
|
||||
import { THEME_INIT_SCRIPT, THEME_INIT_STYLES } from '@ermnvldmr/ui/dev';
|
||||
import { localeRsbuildConfig } from '@ermnvldmr/i18n/dev';
|
||||
import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin';
|
||||
@@ -26,11 +31,20 @@ const MIME: Record<string, string> = {
|
||||
'.txt': 'text/plain',
|
||||
};
|
||||
|
||||
const UMAMI_WWW_WEBSITE_ID = '4fca5ac2-4fe4-4626-b708-933c37bfe918';
|
||||
const locale = process.env.LOCALE ?? 'en';
|
||||
const fontBase = `/${locale}/static/font`;
|
||||
|
||||
export default defineSSGServiceConfig(
|
||||
mergeConfig(localeRsbuildConfig(), {
|
||||
analytics: [
|
||||
umamiAnalytics({
|
||||
serverUrl: 'https://umami.ermnvldmr.com',
|
||||
websiteId: UMAMI_WWW_WEBSITE_ID,
|
||||
domains: 'ermnvldmr.com,www.ermnvldmr.com',
|
||||
doNotTrack: true,
|
||||
}),
|
||||
],
|
||||
dev: {
|
||||
// Serve public/static/* at /static/* directly, bypassing server.base.
|
||||
// Without this, server.base (e.g. /en) would push the public dir to
|
||||
|
||||
Reference in new issue
Block a user