Skip to content

Conversation

@youz2me
Copy link
Member

@youz2me youz2me commented May 27, 2025

👻 PULL REQUEST

📄 작업 내용

  • AmplitudeManager를 구현했어요.
  • 각 화면에 트래킹 코드를 추가했어요.

👀 기타 더 이야기해볼 점

  • 대충쓰래서대충씀

🔗 연결된 이슈

Summary by CodeRabbit

  • New Features

    • Introduced comprehensive event tracking for user interactions across various screens, including login, onboarding, home, community, profile, and post creation.
    • Added analytics for tab navigation, button taps, and key actions such as uploading posts, applying to communities, and completing sign-up or account deletion flows.
  • Refactor

    • Centralized and updated analytics event tracking to use a unified manager with predefined event tags for consistency and clarity.

@youz2me youz2me requested a review from JinUng41 May 27, 2025 16:48
@youz2me youz2me self-assigned this May 27, 2025
@youz2me youz2me added ♻️ refactor 기존 코드를 리팩토링하거나 수정하는 등 사용 (생산적인 경우) 🍻 진웅 술 한잔 가온나~ 🦉 유진 🛌🛌🛌🛌🛌🛌🛌🛌🛌🛌 labels May 27, 2025
@coderabbitai
Copy link

coderabbitai bot commented May 27, 2025

Warning

Rate limit exceeded

@youz2me has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 23 minutes and 44 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 03734c3 and a015c13.

📒 Files selected for processing (1)
  • Wable-iOS/Presentation/Home/View/HomeDetailViewController.swift (6 hunks)

"""

Walkthrough

The changes introduce a centralized AmplitudeManager for analytics event tracking, replacing previous string-based event tracking with a type-safe enum approach. The manager is relocated under a new Core/Amplitude group. Event tracking calls are added or refactored throughout the app to use this new manager and its enum tags.

Changes

File(s) Change Summary
Wable-iOS/Core/Amplitude/AmplitudeManager.swift Added new singleton AmplitudeManager with an EventTag enum for analytics event tracking.
Wable-iOS/Presentation/Helper/AmplitudeManager.swift Removed old AmplitudeManager implementation.
Wable-iOS.xcodeproj/project.pbxproj Moved AmplitudeManager.swift to Core/Amplitude group in project structure.
Wable-iOS/Presentation/Community/View/Cell/CommunityInviteCell.swift
Wable-iOS/Presentation/Community/View/CommunityViewController.swift
Wable-iOS/Presentation/Home/View/HomeDetailViewController.swift
Wable-iOS/Presentation/Home/View/HomeViewController.swift
Wable-iOS/Presentation/Home/View/WritePostViewController.swift
Wable-iOS/Presentation/Login/LoginViewController.swift
Wable-iOS/Presentation/Notification/Page/View/NotificationPageViewController.swift
Wable-iOS/Presentation/Onboarding/ViewController/AgreementViewController.swift
Wable-iOS/Presentation/Onboarding/ViewController/LCKTeamViewController.swift
Wable-iOS/Presentation/Onboarding/ViewController/LCKYearViewController.swift
Wable-iOS/Presentation/Onboarding/ViewController/ProfileRegisterViewController.swift
Wable-iOS/Presentation/Overview/Page/View/OverviewPageViewController.swift
Wable-iOS/Presentation/Profile/AccountInfo/View/AccountInfoViewController.swift
Wable-iOS/Presentation/Profile/My/View/Cell/MyProfileEmptyCell.swift
Wable-iOS/Presentation/Profile/My/View/MyProfileViewController.swift
Wable-iOS/Presentation/Profile/Withdrawal/Guide/View/WithdrawalGuideViewController.swift
Wable-iOS/Presentation/Profile/Withdrawal/Reason/View/WithdrawalReasonViewController.swift
Wable-iOS/Presentation/TabBar/TabBarController.swift
Wable-iOS/Presentation/Viewit/Create/View/CreateViewitViewController.swift
Wable-iOS/Presentation/WableComponent/ViewController/NotFoundViewController.swift
Refactored or added event tracking calls to use new AmplitudeManager.shared.trackEvent(tag: .eventTag) with enum tags.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ViewController
    participant AmplitudeManager
    participant AmplitudeSDK

    User->>ViewController: Triggers UI event (e.g., button tap)
    ViewController->>AmplitudeManager: trackEvent(tag: .eventTag)
    AmplitudeManager->>AmplitudeSDK: track(eventName)
    AmplitudeSDK-->>AmplitudeManager: Event logged
    AmplitudeManager-->>ViewController: Return
Loading

Assessment against linked issues

Objective (Issue) Addressed Explanation
Centralize Amplitude analytics tracking via a manager (#207)
Replace string-based event tags with enum-based tags (#207)
Refactor all event tracking calls to use new manager (#207)
Remove legacy AmplitudeManager implementation (#207)

Suggested reviewers

  • JinUng41

Poem

In the warren of code, a rabbit did see
Events tracked with care, enum tags set free.
Amplitude now listens, as users hop and click,
With a centralized manager, the process is slick.
Analytics in order, the burrow feels bright—
This refactor’s a carrot, and all’s coded right! 🥕
"""

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Collaborator

@JinUng41 JinUng41 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 😄

@github-project-automation github-project-automation bot moved this to In Review in Wable-iOS May 27, 2025
@youz2me youz2me merged commit b6d5dca into develop May 27, 2025
@youz2me youz2me deleted the refactor/#207-amplitude branch May 27, 2025 16:51
@github-project-automation github-project-automation bot moved this from In Review to Done in Wable-iOS May 27, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (6)
Wable-iOS/Presentation/Home/View/HomeDetailViewController.swift (3)

204-207: Fix unused closure parameter.

The indexPath parameter in the cell registration closure is unused and should be replaced with _ to follow Swift conventions and address the static analysis warning.

-> {
-    [weak self] cell,
-    indexPath,
-    item in
+    [weak self] cell,
+    _,
+    item in
🧰 Tools
🪛 SwiftLint (0.57.0)

[Warning] 206-206: Unused parameter in a closure should be replaced with _

(unused_closure_parameter)


204-207: Address the unused closure parameter warning.

Static analysis indicates an unused parameter in the closure. Consider using _ for unused parameters to improve code clarity.

Apply this diff to address the warning:

        > {
-            [weak self] cell,
-            indexPath,
-            item in
+            [weak self] cell,
+            _,
+            item in
🧰 Tools
🪛 SwiftLint (0.57.0)

[Warning] 206-206: Unused parameter in a closure should be replaced with _

(unused_closure_parameter)


204-207: Address unused closure parameter warning.

The static analysis tool flagged an unused parameter in the closure. Based on the context, the indexPath parameter appears to be unused in the cell registration closure.

Apply this diff to address the SwiftLint warning:

-        > {
-            [weak self] cell,
-            indexPath,
-            item in
+        > { [weak self] cell, _, item in
🧰 Tools
🪛 SwiftLint (0.57.0)

[Warning] 206-206: Unused parameter in a closure should be replaced with _

(unused_closure_parameter)

Wable-iOS/Core/Amplitude/AmplitudeManager.swift (3)

21-23: Consider adding error handling for analytics failures.

The current implementation doesn't handle potential Amplitude SDK failures. While analytics failures shouldn't crash the app, logging them could help with debugging.

 func trackEvent(tag: EventTag) {
-    amplitude.track(eventType: tag.value)
+    do {
+        amplitude.track(eventType: tag.value)
+    } catch {
+        // Analytics failures should not crash the app
+        print("Analytics tracking failed: \(error)")
+    }
 }

Alternatively, if the Amplitude SDK doesn't throw errors, consider wrapping in a do-catch for future-proofing or adding completion handlers if needed.


30-129: Consider organizing the large EventTag enum.

The enum contains 46 cases which makes it difficult to maintain. Consider grouping related events using nested enums or separate enums by feature area.

Example organization approach:

enum EventTag: CaseIterable {
    case navigation(NavigationEvent)
    case content(ContentEvent)
    case auth(AuthEvent)
    case account(AccountEvent)
    
    enum NavigationEvent: String, CaseIterable {
        case clickCommunityBotnavi = "click_community_botnavi"
        case clickViewitBotnavi = "click_viewit_botnavi"
        // ... other navigation events
    }
    
    enum ContentEvent: String, CaseIterable {
        case clickLikePost = "click_like_post"
        case clickGhostPost = "click_ghost_post"
        // ... other content events
    }
    
    var value: String {
        switch self {
        case .navigation(let event): return event.rawValue
        case .content(let event): return event.rawValue
        // ... other cases
        }
    }
}

21-23: Consider adding error handling for robustness.

While the current implementation is clean, consider adding basic error handling to prevent potential crashes from Amplitude SDK issues.

 func trackEvent(tag: EventTag) {
-    amplitude.track(eventType: tag.value)
+    do {
+        amplitude.track(eventType: tag.value)
+    } catch {
+        // Log error or handle silently to prevent analytics from crashing the app
+        print("Analytics tracking failed: \(error)")
+    }
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8c38f63 and 03734c3.

📒 Files selected for processing (23)
  • Wable-iOS.xcodeproj/project.pbxproj (2 hunks)
  • Wable-iOS/Core/Amplitude/AmplitudeManager.swift (1 hunks)
  • Wable-iOS/Presentation/Community/View/Cell/CommunityInviteCell.swift (1 hunks)
  • Wable-iOS/Presentation/Community/View/CommunityViewController.swift (1 hunks)
  • Wable-iOS/Presentation/Helper/AmplitudeManager.swift (0 hunks)
  • Wable-iOS/Presentation/Home/View/HomeDetailViewController.swift (7 hunks)
  • Wable-iOS/Presentation/Home/View/HomeViewController.swift (5 hunks)
  • Wable-iOS/Presentation/Home/View/WritePostViewController.swift (2 hunks)
  • Wable-iOS/Presentation/Login/LoginViewController.swift (2 hunks)
  • Wable-iOS/Presentation/Notification/Page/View/NotificationPageViewController.swift (1 hunks)
  • Wable-iOS/Presentation/Onboarding/ViewController/AgreementViewController.swift (2 hunks)
  • Wable-iOS/Presentation/Onboarding/ViewController/LCKTeamViewController.swift (2 hunks)
  • Wable-iOS/Presentation/Onboarding/ViewController/LCKYearViewController.swift (1 hunks)
  • Wable-iOS/Presentation/Onboarding/ViewController/ProfileRegisterViewController.swift (2 hunks)
  • Wable-iOS/Presentation/Overview/Page/View/OverviewPageViewController.swift (1 hunks)
  • Wable-iOS/Presentation/Profile/AccountInfo/View/AccountInfoViewController.swift (1 hunks)
  • Wable-iOS/Presentation/Profile/My/View/Cell/MyProfileEmptyCell.swift (1 hunks)
  • Wable-iOS/Presentation/Profile/My/View/MyProfileViewController.swift (1 hunks)
  • Wable-iOS/Presentation/Profile/Withdrawal/Guide/View/WithdrawalGuideViewController.swift (1 hunks)
  • Wable-iOS/Presentation/Profile/Withdrawal/Reason/View/WithdrawalReasonViewController.swift (1 hunks)
  • Wable-iOS/Presentation/TabBar/TabBarController.swift (1 hunks)
  • Wable-iOS/Presentation/Viewit/Create/View/CreateViewitViewController.swift (1 hunks)
  • Wable-iOS/Presentation/WableComponent/ViewController/NotFoundViewController.swift (1 hunks)
💤 Files with no reviewable changes (1)
  • Wable-iOS/Presentation/Helper/AmplitudeManager.swift
🧰 Additional context used
🧬 Code Graph Analysis (16)
Wable-iOS/Presentation/Profile/AccountInfo/View/AccountInfoViewController.swift (1)
Wable-iOS/Core/Amplitude/AmplitudeManager.swift (1)
  • trackEvent (21-23)
Wable-iOS/Presentation/Profile/My/View/Cell/MyProfileEmptyCell.swift (1)
Wable-iOS/Core/Amplitude/AmplitudeManager.swift (1)
  • trackEvent (21-23)
Wable-iOS/Presentation/Profile/My/View/MyProfileViewController.swift (1)
Wable-iOS/Core/Amplitude/AmplitudeManager.swift (1)
  • trackEvent (21-23)
Wable-iOS/Presentation/Profile/Withdrawal/Reason/View/WithdrawalReasonViewController.swift (1)
Wable-iOS/Core/Amplitude/AmplitudeManager.swift (1)
  • trackEvent (21-23)
Wable-iOS/Presentation/Onboarding/ViewController/LCKTeamViewController.swift (1)
Wable-iOS/Core/Amplitude/AmplitudeManager.swift (1)
  • trackEvent (21-23)
Wable-iOS/Presentation/Viewit/Create/View/CreateViewitViewController.swift (1)
Wable-iOS/Core/Amplitude/AmplitudeManager.swift (1)
  • trackEvent (21-23)
Wable-iOS/Presentation/Overview/Page/View/OverviewPageViewController.swift (1)
Wable-iOS/Core/Amplitude/AmplitudeManager.swift (1)
  • trackEvent (21-23)
Wable-iOS/Presentation/Onboarding/ViewController/LCKYearViewController.swift (1)
Wable-iOS/Core/Amplitude/AmplitudeManager.swift (1)
  • trackEvent (21-23)
Wable-iOS/Presentation/Community/View/CommunityViewController.swift (1)
Wable-iOS/Core/Amplitude/AmplitudeManager.swift (1)
  • trackEvent (21-23)
Wable-iOS/Presentation/Home/View/WritePostViewController.swift (1)
Wable-iOS/Core/Amplitude/AmplitudeManager.swift (1)
  • trackEvent (21-23)
Wable-iOS/Presentation/Profile/Withdrawal/Guide/View/WithdrawalGuideViewController.swift (1)
Wable-iOS/Core/Amplitude/AmplitudeManager.swift (1)
  • trackEvent (21-23)
Wable-iOS/Presentation/WableComponent/ViewController/NotFoundViewController.swift (1)
Wable-iOS/Core/Amplitude/AmplitudeManager.swift (1)
  • trackEvent (21-23)
Wable-iOS/Presentation/Community/View/Cell/CommunityInviteCell.swift (1)
Wable-iOS/Core/Amplitude/AmplitudeManager.swift (1)
  • trackEvent (21-23)
Wable-iOS/Presentation/Login/LoginViewController.swift (1)
Wable-iOS/Core/Amplitude/AmplitudeManager.swift (1)
  • trackEvent (21-23)
Wable-iOS/Presentation/Notification/Page/View/NotificationPageViewController.swift (1)
Wable-iOS/Core/Amplitude/AmplitudeManager.swift (1)
  • trackEvent (21-23)
Wable-iOS/Presentation/TabBar/TabBarController.swift (1)
Wable-iOS/Core/Amplitude/AmplitudeManager.swift (1)
  • trackEvent (21-23)
🪛 SwiftLint (0.57.0)
Wable-iOS/Presentation/Home/View/HomeDetailViewController.swift

[Warning] 206-206: Unused parameter in a closure should be replaced with _

(unused_closure_parameter)

🔇 Additional comments (47)
Wable-iOS/Presentation/Onboarding/ViewController/LCKYearViewController.swift (1)

113-113: Well-implemented analytics tracking.

The event tracking is correctly placed before the navigation action and uses an appropriate, descriptive event name that follows the established naming convention.

Wable-iOS/Presentation/Profile/My/View/MyProfileViewController.swift (1)

447-447: Appropriate logout event tracking.

The tracking call is well-positioned to capture the user's final confirmation of logout before executing the logout logic. The event name clearly indicates this is the completion of the logout flow.

Wable-iOS/Presentation/Profile/AccountInfo/View/AccountInfoViewController.swift (1)

159-159: Correct account deletion tracking implementation.

The event tracking appropriately captures the user's initiation of the account deletion flow with a clear, descriptive event name and proper placement before the navigation action.

Wable-iOS/Presentation/Viewit/Create/View/CreateViewitViewController.swift (1)

153-153: Excellent reactive analytics implementation.

The tracking is properly implemented using the handleEvents operator, which is the correct way to handle side effects like analytics in reactive streams. The event name is descriptive and the placement before debouncing ensures the tracking occurs on every tap.

Wable-iOS/Presentation/Profile/Withdrawal/Reason/View/WithdrawalReasonViewController.swift (1)

194-195: LGTM! Proper analytics tracking implementation.

The event tracking call is correctly placed before the business logic and uses a descriptive event tag that clearly identifies the user action being tracked.

Wable-iOS/Presentation/Community/View/Cell/CommunityInviteCell.swift (1)

145-146: LGTM! Well-positioned analytics tracking.

The tracking call is appropriately placed after the guard check and before the business logic, ensuring events are only tracked for valid user interactions.

Wable-iOS/Presentation/WableComponent/ViewController/NotFoundViewController.swift (1)

111-112: LGTM! Appropriate navigation tracking.

The event tracking is correctly placed at the start of the action closure, capturing user navigation from error states before executing the business logic.

Wable-iOS/Presentation/Profile/My/View/Cell/MyProfileEmptyCell.swift (1)

89-90: LGTM! Excellent conversion tracking implementation.

The tracking call is well-placed before the closure execution and uses a highly descriptive event name that clearly identifies this important user conversion moment (first post creation).

Wable-iOS/Presentation/Onboarding/ViewController/LCKTeamViewController.swift (1)

75-75: LGTM! Well-placed analytics tracking for onboarding flow.

The event tracking calls are appropriately placed at the beginning of the action methods and use descriptive event tags that clearly indicate user behavior during team selection onboarding.

Also applies to: 87-87

Wable-iOS/Presentation/Notification/Page/View/NotificationPageViewController.swift (1)

173-173: LGTM! Good refactoring to improve type safety.

The migration from string-based to enum-based event tracking improves type safety and aligns with the centralized analytics approach. The event placement and naming remain appropriate for tracking notification page navigation.

Also applies to: 175-175

Wable-iOS/Presentation/Community/View/CommunityViewController.swift (1)

207-207: LGTM! Important user conversion tracking.

The analytics tracking for team zone application is well-placed within the register action closure, ensuring it captures confirmed user intent rather than just button taps. This tracks a key conversion action in the community feature.

Wable-iOS/Presentation/Home/View/WritePostViewController.swift (1)

209-209: LGTM! Proper tracking of content creation actions.

The analytics tracking for photo attachment and post upload actions is well-implemented. These events capture important user engagement metrics in the content creation flow, with appropriate placement at the beginning of each action method.

Also applies to: 228-228

Wable-iOS/Presentation/Overview/Page/View/OverviewPageViewController.swift (1)

208-221: Excellent refactoring to type-safe event tracking!

The implementation correctly replaces string literals with strongly-typed enum cases, improving maintainability and reducing the risk of typos. The event names are descriptive and follow a consistent naming convention.

Wable-iOS/Presentation/Profile/Withdrawal/Guide/View/WithdrawalGuideViewController.swift (1)

141-149: Well-placed analytics events for user withdrawal flow.

The tracking events are strategically placed to capture the complete user journey:

  1. Initial action (.clickNextDeleteguide) when the flow begins
  2. Final confirmation (.clickDoneDeleteaccount) before account deletion

The timing and placement ensure accurate analytics without affecting the existing control flow.

Wable-iOS/Presentation/Login/LoginViewController.swift (2)

139-148: Proper integration of login method tracking.

The event tracking is correctly integrated into the reactive button publishers using handleEvents, ensuring events are captured immediately when login buttons are tapped. This approach maintains the existing reactive flow while adding analytics.


159-161: Smart conditional tracking for signup flow detection.

The conditional logic correctly identifies new users or users without complete profiles, which is an appropriate trigger for signup analytics. This provides valuable insights into the user onboarding funnel.

Wable-iOS.xcodeproj/project.pbxproj (1)

840-840: LGTM! Good architectural reorganization.

Moving AmplitudeManager.swift from Presentation/Helper to Core/Amplitude is a sensible architectural decision. Analytics tracking is core functionality that should be organized accordingly, and creating a dedicated Amplitude group under Core provides better structure and separation of concerns.

Also applies to: 1601-1608

Wable-iOS/Presentation/Onboarding/ViewController/ProfileRegisterViewController.swift (3)

98-99: Excellent analytics implementation for profile picture change tracking.

The tracking event is appropriately placed at the beginning of the method to ensure it captures the user intent regardless of the subsequent logic flow.


105-106: Well-positioned tracking for photo picker interaction.

Good placement before the permission check logic ensures the user action is tracked even if permissions need to be handled.


145-146: Proper tracking placement for profile registration completion.

The event is tracked after validation but before navigation, which provides accurate user flow analytics.

Wable-iOS/Presentation/TabBar/TabBarController.swift (1)

200-213: Comprehensive tab navigation tracking implementation.

The switch statement properly covers all tab indices and uses descriptive event names that clearly identify each tab selection. The placement after the scroll-to-top logic but before the loading screen logic is optimal for accurate analytics.

Wable-iOS/Presentation/Home/View/HomeViewController.swift (5)

194-195: Excellent placement for like button tracking.

The tracking event is positioned right before the actual like action, ensuring accurate capture of user engagement with posts.


212-213: Proper tracking for delete confirmation action.

The event is tracked at the point of user confirmation rather than the initial delete button tap, providing more accurate analytics about actual delete intentions.


299-300: Comprehensive ghost feature tracking implementation.

The tracking covers both the initial ghost button tap and the subsequent popup actions (withdraw vs apply), providing detailed analytics about user behavior in the ghost feature flow.

Also applies to: 308-308, 315-316


346-347: Well-positioned notification navigation tracking.

The tracking event is placed before the navigation action, ensuring the user intent is captured regardless of the subsequent navigation outcome.


504-505: Appropriate tracking for post creation initiation.

The event is tracked at the beginning of the method, capturing user intent to create a post before the navigation to the write post screen.

Wable-iOS/Presentation/Onboarding/ViewController/AgreementViewController.swift (3)

148-149: Strategic tracking for terms and conditions completion.

The tracking event is well-positioned at the beginning of the signup completion flow, capturing the user's commitment to complete the registration process.


224-225: Perfect placement for final onboarding completion tracking.

The tracking event captures the user's final confirmation in the welcome popup, marking the successful completion of the entire onboarding journey.


152-231: Improved code formatting enhances readability.

The reformatted sink closure structure makes the complex nested logic more readable while maintaining the same functionality. The tracking integration is seamless within the existing flow.

Wable-iOS/Presentation/Home/View/HomeDetailViewController.swift (8)

224-225: Excellent analytics integration!

The AmplitudeManager tracking calls are consistently placed and cover all key user interactions including likes, ghosts, comments, and uploads. The tracking happens before the business logic, ensuring events are captured even if subsequent operations fail.

Also applies to: 324-325, 339-340, 353-354, 497-498, 527-528, 582-582


333-334: Consider consolidating duplicate ghost popup tracking.

The ghost popup tracking calls (clickWithdrawghostPopup and clickApplyghostPopup) are duplicated for both posts and comments. This is correct behavior since they track the same user actions in different contexts, providing valuable analytics insights.

Also applies to: 506-507, 515-516


324-349: Ghost post tracking implementation looks good.

The tracking calls for ghost post actions are well-placed and cover the complete user journey including the confirmation popup interactions.


353-353: Comment write tracking is correctly implemented.

The tracking call is appropriately placed before the comment UI setup logic.


497-525: Comment ghost tracking implementation is consistent.

The tracking follows the same pattern as post ghosting with proper popup interaction tracking.


527-527: Reply tracking is well-positioned.

The tracking call correctly captures the reply button interaction before setting up the reply UI.


582-582: Upload comment tracking is properly placed.

The tracking call is correctly positioned before the actual comment submission logic.


224-225: Excellent analytics integration implementation!

The analytics tracking calls are well-positioned before the corresponding user actions and use the new centralized AmplitudeManager with type-safe enum tags. The event naming is semantic and covers all key user interactions including likes, ghosts, comments, and uploads.

Also applies to: 324-325, 333-334, 339-340, 353-354, 497-498, 506-507, 515-516, 527-528, 582-582

Wable-iOS/Core/Amplitude/AmplitudeManager.swift (10)

12-24: Solid singleton implementation with type-safe design.

The AmplitudeManager follows good practices:

  • Proper singleton pattern with private initializer
  • Type-safe enum approach eliminates string typos
  • Clean API with single responsibility

30-129: Comprehensive and well-organized event taxonomy.

The EventTag enum provides excellent coverage of user interactions across the app:

  • Navigation events (tab bar clicks)
  • Content interactions (likes, ghosts, comments)
  • User flow events (signup, login, profile management)
  • Consistent naming convention with clear mapping to string values

The enum design ensures compile-time safety and makes it easy to discover available events.


18-18:

Details

✅ Verification successful

Verify Bundle.amplitudeAppKey extension exists.

The code references Bundle.amplitudeAppKey which appears to be a custom extension. Ensure this extension is properly implemented and the API key is securely configured.


🏁 Script executed:

#!/bin/bash
# Search for Bundle extension that provides amplitudeAppKey
ast-grep --pattern 'extension Bundle {
  $$$
  amplitudeAppKey
  $$$
}'

# Also search for any Bundle+Extension files
fd -e swift -x grep -l "amplitudeAppKey" {}

Length of output: 207


🏁 Script executed:

#!/bin/bash
# Inspect the Bundle extension implementation for amplitudeAppKey
rg -n "amplitudeAppKey" Wable-iOS/Core/Bundle/Bundle+.swift -A5 -B5

Length of output: 385


Confirmed Bundle.amplitudeAppKey Extension

The amplitudeAppKey property is implemented in Wable-iOS/Core/Bundle/Bundle+.swift (lines 37–42) and correctly reads AMPLITUDE_APP_KEY from the app’s Info.plist.

• Ensure that your Info.plist includes the AMPLITUDE_APP_KEY entry with the correct value.
• Consider secure handling of this key if you move away from compile-time configuration.


12-24: The singleton pattern and basic structure look good.

The implementation follows standard singleton patterns and properly encapsulates the Amplitude SDK.


78-127: Event naming convention is consistent.

The string values follow a consistent snake_case naming pattern which is good for analytics consistency.


17-19:

Details

❌ Incorrect review comment

Add error handling for missing API key.

The initialization assumes Bundle.amplitudeAppKey exists, which could cause a runtime crash if the key is missing from the bundle.

Apply this diff to add proper error handling:

    private init() {
-        amplitude = Amplitude(configuration: Configuration(apiKey: Bundle.amplitudeAppKey))
+        guard let apiKey = Bundle.amplitudeAppKey, !apiKey.isEmpty else {
+            fatalError("Amplitude API key not found in bundle configuration")
+        }
+        amplitude = Amplitude(configuration: Configuration(apiKey: apiKey))
    }

Run this script to verify if the Bundle extension exists:


🏁 Script executed:

#!/bin/bash
# Description: Check if Bundle.amplitudeAppKey extension exists
# Expected: Find the Bundle extension that provides amplitudeAppKey

rg -A 5 "extension Bundle" --type swift
rg "amplitudeAppKey" --type swift

Length of output: 708


No additional error handling needed for Amplitude API key

The Bundle.amplitudeAppKey property in Wable-iOS/Core/Bundle/Bundle+.swift already uses a guard with fatalError if the key is missing, so the initializer’s use of Bundle.amplitudeAppKey is safe.

• Wable-iOS/Core/Bundle/Bundle+.swift:
static let amplitudeAppKey: String = {
guard let key = … else { fatalError("Amplitude API key not found in bundle configuration") }
return key
}()

Likely an incorrect or invalid review comment.


21-23: 🛠️ Refactor suggestion

Consider adding error handling for tracking failures.

The trackEvent method doesn't handle potential Amplitude SDK errors or edge cases.

Apply this diff to add basic error handling:

    func trackEvent(tag: EventTag) {
-        amplitude.track(eventType: tag.value)
+        do {
+            amplitude.track(eventType: tag.value)
+        } catch {
+            print("⚠️ Amplitude tracking failed for event: \(tag.value), error: \(error)")
+        }
    }

Likely an incorrect or invalid review comment.


12-24: Well-designed centralized analytics manager!

The singleton pattern and type-safe enum approach significantly improves the analytics implementation by:

  • Centralizing event tracking logic
  • Eliminating string literal errors through compile-time safety
  • Providing a clean, consistent API across the app

30-129: Comprehensive and well-organized event taxonomy.

The EventTag enum provides excellent coverage of user interactions across the app with consistent naming conventions. The computed property approach for string mapping keeps the implementation clean and maintainable.


18-18:

Details

✅ Verification successful

Verify Bundle.amplitudeAppKey availability.

Ensure that the Bundle.amplitudeAppKey extension or property exists and contains a valid API key.


🏁 Script executed:

#!/bin/bash
# Description: Search for Bundle.amplitudeAppKey definition in the codebase
# Expected: Find the extension or property definition for amplitudeAppKey

rg -A 3 "amplitudeAppKey" --type swift

Length of output: 723


Amplitude API Key Availability Verified

The Bundle.amplitudeAppKey property is defined in Wable-iOS/Core/Bundle/Bundle+.swift and correctly reads the AMPLITUDE_APP_KEY from the app’s Info.plist (with a fatalError if missing). No further changes are needed here.

self.present(PhotoDetailViewController(image: image), animated: true)
},
likeButtonTapHandler: {
AmplitudeManager.shared.trackEvent(tag: .clickLikeComment)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix incorrect event tag for content like action.

The event tag .clickLikeComment is being used for liking content/posts, but the tag name suggests it's for liking comments. This creates confusion in analytics data.

Apply this diff to use the correct event tag:

-                    AmplitudeManager.shared.trackEvent(tag: .clickLikeComment)
+                    AmplitudeManager.shared.trackEvent(tag: .clickLikePost)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
AmplitudeManager.shared.trackEvent(tag: .clickLikeComment)
AmplitudeManager.shared.trackEvent(tag: .clickLikePost)
🤖 Prompt for AI Agents
In Wable-iOS/Presentation/Home/View/HomeDetailViewController.swift at line 224,
the event tag used for tracking the like action is incorrectly set to
.clickLikeComment, which implies liking a comment rather than content or posts.
Replace the event tag with the correct one that accurately represents liking
content, such as .clickLikeContent or the appropriate tag defined for content
likes, to ensure analytics data is accurate and clear.

youz2me added a commit that referenced this pull request Oct 26, 2025
[Refactor] AmplitudeManager 구현 및 트래킹 코드 추가
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

♻️ refactor 기존 코드를 리팩토링하거나 수정하는 등 사용 (생산적인 경우) 🍻 진웅 술 한잔 가온나~ 🦉 유진 🛌🛌🛌🛌🛌🛌🛌🛌🛌🛌

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Refactor] Amplitude 추가

3 participants