Skip to content

Commit caca79c

Browse files
authored
Merge pull request #27 from Check-Data-Out/feature/gtag
[25.03.26 / TASK-149] Feature - 공지사항 버튼 gtag 추가
1 parent bd25eba commit caca79c

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

Diff for: package.json

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@tailwindcss/typography": "^0.5.16",
2727
"@tanstack/react-query": "^5.69.0",
2828
"@tanstack/react-query-devtools": "^5.69.0",
29+
"@types/gtag.js": "^0.0.20",
2930
"chart.js": "^4.4.7",
3031
"js-cookie": "^3.0.5",
3132
"next": "14.2.18",

Diff for: pnpm-lock.yaml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/app/(auth-required)/components/notice/index.tsx

+4-10
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,9 @@ export const Notice = () => {
1919

2020
useEffect(() => {
2121
try {
22-
const lastUpdated = new Date(
23-
data?.posts[0].created_at?.split('T')[0] as string,
24-
).getTime();
22+
const lastUpdated = new Date(data?.posts[0].created_at?.split('T')[0] as string).getTime();
2523

26-
const daysSinceUpdate = Math.ceil(
27-
(new Date().getTime() - lastUpdated) / DAY_IN_MS,
28-
);
24+
const daysSinceUpdate = Math.ceil((new Date().getTime() - lastUpdated) / DAY_IN_MS);
2925

3026
if (daysSinceUpdate <= RECENT_POST_THRESHOLD_DAYS) {
3127
const expiry = localStorage.getItem(NOTIFICATION_STORAGE_KEY);
@@ -50,10 +46,8 @@ export const Notice = () => {
5046
className="text-PRIMARY-MAIN hover:text-PRIMARY-SUB text-ST4 transition-all duration-300 max-MBI:text-ST5"
5147
onClick={() => {
5248
setShow(false);
53-
localStorage.setItem(
54-
'noti_expiry',
55-
JSON.stringify(new Date().getTime() + TTL),
56-
);
49+
window.gtag('event', 'click_event', { target: '공지사항 버튼' });
50+
localStorage.setItem('noti_expiry', JSON.stringify(new Date().getTime() + TTL));
5751

5852
open(<Modal />);
5953
}}

0 commit comments

Comments
 (0)