-
Notifications
You must be signed in to change notification settings - Fork 0
[feat] #192 Firebase Analytics(GA4) 이벤트 로깅 추가 #195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
c24a983
[chore] #192 core:analytics 모듈 생성
Ojongseok f68de49
[chore] #192 Firebase 애널리틱스 로깅 인터페이스 작성
Ojongseok 1301d2e
[chore] #192 AnalyticsModule 생성
Ojongseok c6c0aee
Merge branch 'develop' of https://github.com/YAPP-Github/27th-App-Tea…
Ojongseok b314f80
[chore] #192 guava 라이브러리 추가
Ojongseok 8a969fa
[chore] #192 feature:photo-upload 모듈의 guava 의존성 추가
Ojongseok cbf7ff0
[chore] #192 Feature 플러그인 내 analytics 공통 의존성 추가
Ojongseok 08e7f2f
[feat] #192 네컷지도 최대 줌레벨 설정 및 기본 줌레벨 변경
Ojongseok c98fe91
[chore] #192 AnalyticsEvent 이벤트 정의
Ojongseok a87f994
[chore] #192 AnalyticsEvent 이벤트 로깅 구문 추가
Ojongseok e256ba7
[chore] #192 logger 디렉토리 생성 및 경로 이동
Ojongseok 53ee082
[chore] #192 Feature 단위 이벤트 분리
Ojongseok 0263996
[chore] #192 AnalyticsEvent 경로 변경에 따른 import 수정
Ojongseok 8b9f555
[feat] #192 네컷지도 최대 줌 레벨 14.0으로 변경
Ojongseok fbb61e9
[chore] #192 detekt trailing comma 및 unused import 수정
Ojongseok fc269fd
[feat] #192 이벤트별 로깅 파라미터 타입 수정
Ojongseok 7fee14d
[chore] #192 MapBrandFilterToggle 이벤트 로깅 reduce 구문 외부로 이동
Ojongseok 482fced
[chore] #192 사진 복제 이벤트 로깅 구문 수정
Ojongseok 73d55b1
[chore] #192 UserProperty 로깅 구문 위치 변경
Ojongseok 437c38e
[chore] #192 로그아웃 및 회원 탈퇴 이벤트 추가
Ojongseok ef3ad4d
[chore] #192 resetAnalytics() 로깅 구문 제거
Ojongseok ce2de75
[chore] #192 detekt 룰 설정
Ojongseok File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,13 @@ | ||
| plugins { | ||
| alias(libs.plugins.neki.android.library) | ||
| alias(libs.plugins.neki.hilt) | ||
| } | ||
|
|
||
| android { | ||
| namespace = "com.neki.android.core.analytics" | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation(platform(libs.firebase.bom)) | ||
| implementation(libs.firebase.analytics) | ||
| } |
8 changes: 8 additions & 0 deletions
8
core/analytics/src/main/kotlin/com/neki/android/core/analytics/event/AnalyticsEvent.kt
This file contains hidden or 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,8 @@ | ||
| package com.neki.android.core.analytics.event | ||
|
|
||
| sealed interface AnalyticsEvent { | ||
|
|
||
| val name: String | ||
| val params: Map<String, Any> | ||
| get() = emptyMap() | ||
| } | ||
49 changes: 49 additions & 0 deletions
49
.../analytics/src/main/kotlin/com/neki/android/core/analytics/event/ArchiveAnalyticsEvent.kt
This file contains hidden or 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,49 @@ | ||
| package com.neki.android.core.analytics.event | ||
|
|
||
| sealed interface ArchiveAnalyticsEvent : AnalyticsEvent { | ||
|
|
||
| data object ArchivingView : ArchiveAnalyticsEvent { | ||
| override val name = "archiving_view" | ||
| } | ||
|
|
||
| data class PhotoUpload(val method: String, val count: Int) : ArchiveAnalyticsEvent { | ||
| override val name = "photo_upload" | ||
| override val params = mapOf( | ||
| "method" to method, | ||
| "count" to count, | ||
| ) | ||
| } | ||
|
|
||
| data object AlbumCreate : ArchiveAnalyticsEvent { | ||
| override val name = "album_create" | ||
| } | ||
|
|
||
| data class AlbumAddFromDetail(val albumCount: Int) : ArchiveAnalyticsEvent { | ||
| override val name = "album_add_from_detail" | ||
| override val params = mapOf("album_count" to albumCount) | ||
| } | ||
|
|
||
| data class AlbumAddFromMulti(val photoCount: Int, val albumCount: Int) : ArchiveAnalyticsEvent { | ||
| override val name = "album_add_from_multi" | ||
| override val params = mapOf( | ||
| "photo_count" to photoCount, | ||
| "album_count" to albumCount, | ||
| ) | ||
| } | ||
|
|
||
| data object PhotoMove : ArchiveAnalyticsEvent { | ||
| override val name = "photo_move" | ||
| } | ||
|
|
||
| data object PhotoCopy : ArchiveAnalyticsEvent { | ||
| override val name = "photo_copy" | ||
| } | ||
|
|
||
| data object PhotoDetailView : ArchiveAnalyticsEvent { | ||
| override val name = "photo_detail_view" | ||
| } | ||
|
|
||
| data object PhotoMemoCreate : ArchiveAnalyticsEvent { | ||
| override val name = "photo_memo_create" | ||
| } | ||
| } |
8 changes: 8 additions & 0 deletions
8
core/analytics/src/main/kotlin/com/neki/android/core/analytics/event/GlobalAnalyticsEvent.kt
This file contains hidden or 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,8 @@ | ||
| package com.neki.android.core.analytics.event | ||
|
|
||
| sealed interface GlobalAnalyticsEvent : AnalyticsEvent { | ||
|
|
||
| data object AppOpen : GlobalAnalyticsEvent { | ||
| override val name = "app_open" | ||
| } | ||
| } |
42 changes: 42 additions & 0 deletions
42
core/analytics/src/main/kotlin/com/neki/android/core/analytics/event/MapAnalyticsEvent.kt
This file contains hidden or 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,42 @@ | ||
| package com.neki.android.core.analytics.event | ||
|
|
||
| sealed interface MapAnalyticsEvent : AnalyticsEvent { | ||
|
|
||
| data object MapView : MapAnalyticsEvent { | ||
| override val name = "map_view" | ||
| } | ||
|
|
||
| data class MapReSearch(val hasFilter: Boolean, val regionChanged: Boolean) : MapAnalyticsEvent { | ||
| override val name = "map_re_search" | ||
| override val params = mapOf( | ||
| "has_filter" to hasFilter, | ||
| "region_changed" to regionChanged, | ||
| ) | ||
| } | ||
|
|
||
| data class MapBrandFilterToggle( | ||
| val action: String, | ||
| val selectedCount: Int, | ||
| val brandName: String, | ||
| ) : MapAnalyticsEvent { | ||
| override val name = "map_brand_filter_toggle" | ||
| override val params = mapOf( | ||
| "action" to action, | ||
| "selected_count" to selectedCount, | ||
| "brand_name" to brandName, | ||
| ) | ||
| } | ||
|
|
||
| data class BoothSelect(val entryPoint: String, val brandName: String) : MapAnalyticsEvent { | ||
| override val name = "booth_select" | ||
| override val params = mapOf( | ||
| "entry_point" to entryPoint, | ||
| "brand_name" to brandName, | ||
| ) | ||
| } | ||
|
|
||
| data class MapRouteClick(val mapType: String) : MapAnalyticsEvent { | ||
| override val name = "map_route_click" | ||
| override val params = mapOf("map_type" to mapType) | ||
| } | ||
| } |
12 changes: 12 additions & 0 deletions
12
core/analytics/src/main/kotlin/com/neki/android/core/analytics/event/MypageAnalyticsEvent.kt
This file contains hidden or 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,12 @@ | ||
| package com.neki.android.core.analytics.event | ||
|
|
||
| sealed interface MypageAnalyticsEvent : AnalyticsEvent { | ||
|
|
||
| data object Logout : MypageAnalyticsEvent { | ||
| override val name = "mypage_logout" | ||
| } | ||
|
|
||
| data object Withdraw : MypageAnalyticsEvent { | ||
| override val name = "mypage_withdraw" | ||
| } | ||
| } |
30 changes: 30 additions & 0 deletions
30
core/analytics/src/main/kotlin/com/neki/android/core/analytics/event/PoseAnalyticsEvent.kt
This file contains hidden or 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,30 @@ | ||
| package com.neki.android.core.analytics.event | ||
|
|
||
| sealed interface PoseAnalyticsEvent : AnalyticsEvent { | ||
|
|
||
| data object PoseView : PoseAnalyticsEvent { | ||
| override val name = "pose_view" | ||
| } | ||
|
|
||
| data object PoseRandomStart : PoseAnalyticsEvent { | ||
| override val name = "pose_random_start" | ||
| } | ||
|
|
||
| data class PoseRandomSessionEnd(val totalSwipeCount: Int) : PoseAnalyticsEvent { | ||
| override val name = "pose_random_session_end" | ||
| override val params = mapOf("total_swipe_count" to totalSwipeCount) | ||
| } | ||
|
|
||
| data class PoseFilterToggle(val peopleCount: Int) : PoseAnalyticsEvent { | ||
| override val name = "pose_filter_toggle" | ||
| override val params = mapOf("people_count" to peopleCount) | ||
| } | ||
|
|
||
| data object PoseBookmarkFilter : PoseAnalyticsEvent { | ||
| override val name = "pose_bookmark_filter" | ||
| } | ||
|
|
||
| data object PoseBookmark : PoseAnalyticsEvent { | ||
| override val name = "pose_bookmark" | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
core/analytics/src/main/kotlin/com/neki/android/core/analytics/logger/AnalyticsLogger.kt
This file contains hidden or 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,9 @@ | ||
| package com.neki.android.core.analytics.logger | ||
|
|
||
| import com.neki.android.core.analytics.event.AnalyticsEvent | ||
|
|
||
| interface AnalyticsLogger { | ||
| fun log(event: AnalyticsEvent) | ||
| fun setUserId(userId: String) | ||
| fun setUserProperty(key: String, value: String) | ||
| } | ||
|
Ojongseok marked this conversation as resolved.
|
||
28 changes: 28 additions & 0 deletions
28
core/analytics/src/main/kotlin/com/neki/android/core/analytics/logger/AnalyticsModule.kt
This file contains hidden or 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,28 @@ | ||
| package com.neki.android.core.analytics.logger | ||
|
|
||
| import android.content.Context | ||
| import com.google.firebase.analytics.FirebaseAnalytics | ||
| import dagger.Binds | ||
| import dagger.Module | ||
| import dagger.Provides | ||
| import dagger.hilt.InstallIn | ||
| import dagger.hilt.android.qualifiers.ApplicationContext | ||
| import dagger.hilt.components.SingletonComponent | ||
| import javax.inject.Singleton | ||
|
|
||
| @Module | ||
| @InstallIn(SingletonComponent::class) | ||
| internal abstract class AnalyticsModule { | ||
|
|
||
| @Binds | ||
| @Singleton | ||
| abstract fun bindAnalyticsLogger(impl: FirebaseAnalyticsLogger): AnalyticsLogger | ||
|
|
||
| companion object { | ||
| @Provides | ||
| @Singleton | ||
| fun provideFirebaseAnalytics( | ||
| @ApplicationContext context: Context, | ||
| ): FirebaseAnalytics = FirebaseAnalytics.getInstance(context) | ||
| } | ||
| } |
35 changes: 35 additions & 0 deletions
35
...alytics/src/main/kotlin/com/neki/android/core/analytics/logger/FirebaseAnalyticsLogger.kt
This file contains hidden or 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,35 @@ | ||
| package com.neki.android.core.analytics.logger | ||
|
|
||
| import android.os.Bundle | ||
| import com.google.firebase.analytics.FirebaseAnalytics | ||
| import com.neki.android.core.analytics.event.AnalyticsEvent | ||
| import javax.inject.Inject | ||
|
|
||
| internal class FirebaseAnalyticsLogger @Inject constructor( | ||
| private val firebaseAnalytics: FirebaseAnalytics, | ||
| ) : AnalyticsLogger { | ||
|
|
||
| override fun log(event: AnalyticsEvent) { | ||
| val bundle = Bundle().apply { | ||
| event.params.forEach { (key, value) -> | ||
| when (value) { | ||
| is String -> putString(key, value) | ||
| is Int -> putInt(key, value) | ||
| is Long -> putLong(key, value) | ||
| is Double -> putDouble(key, value) | ||
| is Boolean -> putBoolean(key, value) | ||
| else -> putString(key, value.toString()) | ||
| } | ||
| } | ||
| } | ||
|
Ojongseok marked this conversation as resolved.
|
||
| firebaseAnalytics.logEvent(event.name, bundle) | ||
| } | ||
|
|
||
| override fun setUserId(userId: String) { | ||
| firebaseAnalytics.setUserId(userId) | ||
| } | ||
|
|
||
| override fun setUserProperty(key: String, value: String) { | ||
| firebaseAnalytics.setUserProperty(key, value) | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.