-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: window에 ga 접근을 위해 타입 추가 * feat: ga event 발생시키는 함수 추가 * feat: like에 ga 등록 * fix: GA event 속성 중 필요한 것만 남기기 * feat: 노래 상세 페이지 ga 이벤트 추가 * feat: 마이페이지 ga 이벤트 추가 * feat: GA event 상수화 * feat: sendGAEvent 함수 인수별 default값 수정 * feat: 변경된 GA 함수 및 상수 적용 * feat: GA user memberId 가능한 반드시 수집하도록 변경
- Loading branch information
1 parent
3ed2f31
commit e23e1c3
Showing
5 changed files
with
83 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export const GA_ACTIONS = { | ||
COPY_URL: 'click_copy_part', | ||
PLAY: 'click_play_part', | ||
LIKE: 'click_like', | ||
EDIT_PROFILE: 'click_edit_profile', | ||
LOGOUT: 'click_logout', | ||
}; | ||
|
||
export const GA_CATEGORIES = { | ||
SONG_DETAIL: 'song_playing', | ||
MY_PAGE: 'profile', | ||
}; | ||
|
||
export const GA_MEMBER = { | ||
NOT_LOGGED_IN: -1, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { GA_MEMBER } from '@/shared/constants/GAEventName'; | ||
|
||
interface GAProps { | ||
action: string; | ||
category: string; | ||
memberId?: number; | ||
} | ||
|
||
export const sendGAEvent = ({ action, category, memberId = GA_MEMBER.NOT_LOGGED_IN }: GAProps) => { | ||
if ('gtag' in window) { | ||
window?.gtag('event', action, { | ||
event_category: category, | ||
member_id: memberId ? memberId : GA_MEMBER.NOT_LOGGED_IN, | ||
}); | ||
} | ||
}; | ||
|
||
export default sendGAEvent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
interface Window { | ||
gtag: typeof gtag; | ||
} |