From 36589e1763f1920ecb9889ac1b454ec8fcc37257 Mon Sep 17 00:00:00 2001 From: fast1597 Date: Mon, 27 Apr 2026 14:47:52 +0900 Subject: [PATCH 01/30] refactor(analytics): unify GA4 module with taxonomy naming MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename helpers to match GA4-Data-Taxonomy.md naming convention - sendTabChange → sendNavigationTabSelect - sendLinkClick → sendLinkOpen (+ linkGroup, sameHostVariant params) - sendGAEvent("search") → sendSearchSubmit - sendSettingChange → sendSettingsCredentialsSaved / Deleted - sendButtonClick("google_login/logout") → sendAuthLoginStart / sendAuthLogout - sendError → sendSystemError - Add sendExtensionOpen: single call emits extension_first_open (최초 1회), extension_session_start (새 세션 시), extension_open (매번) in one fetch - getOrCreateSessionId now returns { sessionId, isNewSession } to support session_start detection without an extra storage read - Restore and add JSDoc for all exported functions Co-Authored-By: Claude Sonnet 4.6 --- src/App.tsx | 4 +- src/components/Tabs/LinkGroup.tsx | 8 +- src/components/TabsLayout.tsx | 4 +- src/utils/analytics.ts | 295 +++++++++++++++++++++--------- 4 files changed, 218 insertions(+), 93 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 4da3796..f7e617d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,7 +8,7 @@ import { Outlet } from "react-router-dom"; import { ErrorBoundary } from "react-error-boundary"; import { Toaster } from "./components/ui/sonner"; import { PostedTemplatesProvider } from "./contexts/PostedTemplatesContext"; -import { sendPageView } from "./utils/analytics"; +import { sendExtensionOpen } from "./utils/analytics"; import { debugLog } from "@/utils/logger"; import "./App.css"; @@ -20,7 +20,7 @@ function App() { "font-family: Nanum Gothic; color: darkgreen; padding: 6px; border-radius: 4px; font-size:14px", ); debugLog("https://github.com/Turtle-Hwan/LinKU"); - sendPageView("LinKU Extension - Popup", "chrome-extension://linku/popup"); + sendExtensionOpen("popup_home", "popup"); }, []); return ( diff --git a/src/components/Tabs/LinkGroup.tsx b/src/components/Tabs/LinkGroup.tsx index 61479f4..c3f375a 100644 --- a/src/components/Tabs/LinkGroup.tsx +++ b/src/components/Tabs/LinkGroup.tsx @@ -1,6 +1,6 @@ import { LinkList, LinkListElement } from "@/constants/LinkList"; import { getCurrentTab } from "@/utils/chrome"; -import { sendLinkClick } from "@/utils/analytics"; +import { sendLinkOpen } from "@/utils/analytics"; import React, { use } from "react"; interface LinkGroupProps { @@ -42,7 +42,7 @@ const GridItem = ({ item, colNum }) => {