-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Feat] #354 - 콕 찌르기 Amplitude 이벤트 트래킹
- Loading branch information
Showing
21 changed files
with
322 additions
and
82 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
SOPT-iOS/Projects/Core/Sources/Amplitude/AmplitudeEventPropertyBuilder.swift
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,53 @@ | ||
// | ||
// AmplitudeEventPropertyBuilder.swift | ||
// Core | ||
// | ||
// Created by sejin on 1/21/24. | ||
// Copyright © 2024 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public class AmplitudeEventPropertyBuilder<Value: AmplitudeEventPropertyValueConvertible> { | ||
private var eventProperties = [String: Any]() | ||
|
||
public init() {} | ||
|
||
/// ViewType 은 UserType과 같다. | ||
public func addViewType() -> Self { | ||
let key: AmplitudeEventPropertyKey = .viewType | ||
let userType = UserDefaultKeyList.Auth.getUserType() | ||
let value = userType.rawValue.lowercased() | ||
self.eventProperties[key.rawValue] = value | ||
return self | ||
} | ||
|
||
public func add(key: String, value: Any) -> Self { | ||
self.eventProperties[key] = value | ||
return self | ||
} | ||
|
||
public func add(key: AmplitudeEventPropertyKey, value: Any) -> Self { | ||
self.eventProperties[key.rawValue] = value | ||
return self | ||
} | ||
|
||
public func add(key: AmplitudeEventPropertyKey, value: Optional<Any>) -> Self { | ||
self.eventProperties[key.rawValue] = value | ||
return self | ||
} | ||
|
||
public func add(key: AmplitudeEventPropertyKey, value: Value) -> Self { | ||
self.eventProperties[key.rawValue] = value.toString() | ||
return self | ||
} | ||
|
||
public func removeOptional() -> Self { | ||
self.eventProperties = self.eventProperties.compactMapValues { $0 } | ||
return self | ||
} | ||
|
||
public func build() -> [String: Any] { | ||
return eventProperties | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
SOPT-iOS/Projects/Core/Sources/Amplitude/AmplitudeEventPropertyKey.swift
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 @@ | ||
// | ||
// AmplitudeEventPropertyKey.swift | ||
// Core | ||
// | ||
// Created by sejin on 1/21/24. | ||
// Copyright © 2024 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public enum AmplitudeEventPropertyKey: String { | ||
case viewType = "view_type" | ||
case clickViewType = "click_view_type" | ||
|
||
// 콕 찌르기 피쳐 관련 Key | ||
case viewProfile = "view_profile" // 멤버 프로필 id | ||
case friendType = "friend_type" | ||
} |
13 changes: 13 additions & 0 deletions
13
SOPT-iOS/Projects/Core/Sources/Amplitude/AmplitudeEventPropertyValueConvertible.swift
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,13 @@ | ||
// | ||
// AmplitudeEventPropertyValueConvertible.swift | ||
// Core | ||
// | ||
// Created by sejin on 1/21/24. | ||
// Copyright © 2024 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public protocol AmplitudeEventPropertyValueConvertible { | ||
func toString() -> String | ||
} |
39 changes: 39 additions & 0 deletions
39
SOPT-iOS/Projects/Core/Sources/Amplitude/AmplitudeEventType.swift
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,39 @@ | ||
// | ||
// AmplitudeEventType.swift | ||
// Core | ||
// | ||
// Created by sejin on 2023/09/21. | ||
// Copyright © 2023 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public enum AmplitudeEventType: String { | ||
// 클릭 이벤트 | ||
case clickAlarm = "click_alarm" | ||
case clickMyPage = "click_mypage" | ||
case clickAttendacne = "click_attendance" | ||
case clickGroup = "click_group" | ||
case clickProject = "click_project" | ||
case clickMember = "click_member" | ||
case clickOfficialHomepage = "click_homepage" | ||
case clickSoptamp = "click_soptamp" | ||
case clickInstagram = "click_instagram" | ||
case clickYoutube = "click_youtube" | ||
case clickReview = "click_review" | ||
case clickFaq = "click_faq" | ||
case clickPlaygroundCommunity = "click_playground_community" | ||
case clickPoke = "click_poke" | ||
case clickMemberProfile = "click_memberprofile" | ||
case clickPokeIcon = "click_poke_icon" | ||
case clickPokeAlarmDetail = "click_poke_alarm_detail" | ||
case clickPokeQuit = "click_poke_quit" | ||
|
||
// 뷰 이벤트 | ||
case viewAppHome = "view_apphome" | ||
case viewPokeOnboarding = "view_poke_onboarding" | ||
case viewPokeMain = "view_poke_main" | ||
case viewPokeAlarmDetail = "view_poke_alarm_detail" | ||
case viewPokeFriend = "view_poke_friend" | ||
case viewPokeFriendDetail = "view_poke_friend_detail" | ||
} |
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
13 changes: 13 additions & 0 deletions
13
SOPT-iOS/Projects/Core/Sources/Amplitude/AmplitudeUserPropertyKey.swift
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,13 @@ | ||
// | ||
// AmplitudeUserPropertyKey.swift | ||
// Core | ||
// | ||
// Created by sejin on 1/21/24. | ||
// Copyright © 2024 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public enum AmplitudeUserPropertyKey: String { | ||
case stateOfPushNotification = "state_of_push_notification" | ||
} |
28 changes: 0 additions & 28 deletions
28
SOPT-iOS/Projects/Core/Sources/Enum/AmplitudeEventType.swift
This file was deleted.
Oops, something went wrong.
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
16 changes: 0 additions & 16 deletions
16
SOPT-iOS/Projects/Core/Sources/Utils/trackAmplitudeEvent.swift
This file was deleted.
Oops, something went wrong.
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
24 changes: 24 additions & 0 deletions
24
...iOS/Projects/Features/PokeFeature/Sources/Amplitude/PokeAmplitudeEventPropertyValue.swift
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,24 @@ | ||
// | ||
// PokeAmplitudeEventPropertyValue.swift | ||
// PokeFeature | ||
// | ||
// Created by sejin on 1/21/24. | ||
// Copyright © 2024 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Core | ||
|
||
enum PokeAmplitudeEventPropertyValue: String, AmplitudeEventPropertyValueConvertible { | ||
case onboarding = "onboarding" | ||
case pokeMainAlarm = "poke_main_alarm" | ||
case pokeMainFriend = "poke_main_friend" | ||
case pokeMainRecommendNotMyFriend = "poke_main_recommend_notmyfriend" | ||
case pokeMainRecommendMyFriend = "poke_main_recommend_myfriend" | ||
case pokeAlarm = "poke_alarm" | ||
case friend = "friend" | ||
|
||
func toString() -> String { | ||
self.rawValue | ||
} | ||
} |
Oops, something went wrong.