@daeryun/dr_components 1.2.97 → 1.2.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -13,6 +13,7 @@ import * as gtag from '../../lib/gtag';
|
|
|
13
13
|
* 로그인 완료 후 URL에 uuid(idx)를 추가하고 GA 이벤트를 발생시키는 훅
|
|
14
14
|
* - 로그인된 상태이고, URL에 uuid가 없으면 uuid를 추가
|
|
15
15
|
* - 로그인 완료 GA 이벤트 발생
|
|
16
|
+
* - 쿠키에도 uuid 저장 (페이지 이동 시 middleware에서 사용)
|
|
16
17
|
*/
|
|
17
18
|
export const useLoginUuidSync = () => {
|
|
18
19
|
const hasProcessed = useRef(false);
|
|
@@ -62,12 +63,16 @@ export const useLoginUuidSync = () => {
|
|
|
62
63
|
gtag.event({
|
|
63
64
|
event_name: 'login_complete',
|
|
64
65
|
category: 'login',
|
|
65
|
-
label:
|
|
66
|
+
label: `login complete - ${newUrl}`,
|
|
66
67
|
value: '1',
|
|
67
68
|
user_id: String(idx)
|
|
68
69
|
});
|
|
69
70
|
console.log('useLoginUuidSync: GA 이벤트 발생 - login_complete');
|
|
70
71
|
hasProcessed.current = true;
|
|
72
|
+
// 쿠키에 uuid 저장 (세션 쿠키 - 브라우저 닫으면 삭제)
|
|
73
|
+
// middleware에서 페이지 이동 시 URL에 uuid를 자동 추가하는 데 사용
|
|
74
|
+
document.cookie = `_dr_uuid=${idx}; path=/; SameSite=Lax`;
|
|
75
|
+
console.log('useLoginUuidSync: 쿠키 저장 완료 - _dr_uuid:', idx);
|
|
71
76
|
// URL 업데이트 (히스토리에 추가하지 않고 교체)
|
|
72
77
|
window.history.replaceState({}, '', newUrl);
|
|
73
78
|
console.log('useLoginUuidSync: URL 업데이트 완료', newUrl);
|
|
@@ -6,6 +6,7 @@ import { usePathname } from 'next/navigation';
|
|
|
6
6
|
* 로그인 완료 후 URL에 uuid(idx)를 추가하고 GA 이벤트를 발생시키는 훅
|
|
7
7
|
* - 로그인된 상태이고, URL에 uuid가 없으면 uuid를 추가
|
|
8
8
|
* - 로그인 완료 GA 이벤트 발생
|
|
9
|
+
* - 쿠키에도 uuid 저장 (페이지 이동 시 middleware에서 사용)
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
12
|
export const useLoginUuidSync = () => {
|
|
@@ -66,7 +67,7 @@ export const useLoginUuidSync = () => {
|
|
|
66
67
|
gtag.event({
|
|
67
68
|
event_name: 'login_complete',
|
|
68
69
|
category: 'login',
|
|
69
|
-
label:
|
|
70
|
+
label: `login complete - ${newUrl}`,
|
|
70
71
|
value: '1',
|
|
71
72
|
user_id: String(idx)
|
|
72
73
|
});
|
|
@@ -74,6 +75,11 @@ export const useLoginUuidSync = () => {
|
|
|
74
75
|
console.log('useLoginUuidSync: GA 이벤트 발생 - login_complete');
|
|
75
76
|
hasProcessed.current = true;
|
|
76
77
|
|
|
78
|
+
// 쿠키에 uuid 저장 (세션 쿠키 - 브라우저 닫으면 삭제)
|
|
79
|
+
// middleware에서 페이지 이동 시 URL에 uuid를 자동 추가하는 데 사용
|
|
80
|
+
document.cookie = `_dr_uuid=${idx}; path=/; SameSite=Lax`;
|
|
81
|
+
console.log('useLoginUuidSync: 쿠키 저장 완료 - _dr_uuid:', idx);
|
|
82
|
+
|
|
77
83
|
// URL 업데이트 (히스토리에 추가하지 않고 교체)
|
|
78
84
|
window.history.replaceState({}, '', newUrl);
|
|
79
85
|
console.log('useLoginUuidSync: URL 업데이트 완료', newUrl);
|
|
@@ -86,4 +92,4 @@ export const useLoginUuidSync = () => {
|
|
|
86
92
|
}, []);
|
|
87
93
|
};
|
|
88
94
|
|
|
89
|
-
export default useLoginUuidSync;
|
|
95
|
+
export default useLoginUuidSync;
|