Skip to content

Commit 4c4da55

Browse files
committed
feat: test
1 parent 9339134 commit 4c4da55

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

.github/workflows/deploy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ env:
44
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
55

66
on:
7+
push:
8+
branches:
9+
- main
710
pull_request:
811
types:
912
- closed

src/pages/HomePage/HomePage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const HomePage = () => {
6060
<button
6161
className={styles.ShareButton}
6262
onClick={() => {
63-
gTagLogEvent("share_button");
63+
gTagLogEvent("click_share", "Button Click", "Share Button");
6464

6565
send({ type: AppBridgeMessageType.SHARE, payload: { shareText: getShareText() } });
6666
}}
@@ -89,7 +89,7 @@ const HomePage = () => {
8989
text="갤러리"
9090
iconName="gallery"
9191
onClick={() => {
92-
gTagLogEvent("gallery_button");
92+
gTagLogEvent("click_gallery", "Button Click", "Gallery Button");
9393

9494
send({ type: AppBridgeMessageType.OPEN_GALLERY, payload: "" });
9595

@@ -100,7 +100,7 @@ const HomePage = () => {
100100
text="카메라"
101101
iconName="camera"
102102
onClick={() => {
103-
gTagLogEvent("camera_button");
103+
gTagLogEvent("click_camera", "Button Click", "Camera Button");
104104

105105
send({ type: AppBridgeMessageType.OPEN_CAMERA, payload: "" });
106106

src/utils/gtag.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
export const gTagLogEvent = (eventLabel: string) => {
2-
if (typeof window !== "undefined" && typeof window.gtag === "function") {
3-
window.gtag("event", "click", {
4-
event_category: "button",
5-
event_label: eventLabel,
6-
});
7-
} else {
8-
console.warn("Google Analytics is not initialized yet.");
1+
export const gTagLogEvent = (action: string, category = "User Interaction", label?: string) => {
2+
if (typeof window.gtag !== "function") {
3+
console.warn("GA4가 아직 로드되지 않았습니다.");
4+
return;
95
}
6+
7+
window.gtag("event", action, {
8+
event_category: category,
9+
event_label: label,
10+
});
1011
};

0 commit comments

Comments
 (0)