Skip to content

feat: 네이티브 Mixpanel 이벤트에 기기 언어(device_locale)를 붙인다 - #50

Merged
seongwon030 merged 2 commits into
mainfrom
seongwon030/moadong-30-design-review
Nov 21, 2026
Merged

seongwon030 merged 2 commits into
mainfrom
seongwon030/moadong-30-design-review

Conversation

@seongwon030

@seongwon030 seongwon030 commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Closes #30

왜 필요한지

외국인 유학생 수요를 보려고 웹(Moadong/moadong#1920)은 기기 언어를 device_locale super property로 이미 수집합니다. 앱은 mixpanel-react-native로 웹과 별개의 Mixpanel 인스턴스를 써서, 네이티브에서만 나는 이벤트에는 이 값이 붙지 않았습니다. 특히 구독(SUBSCRIBE_BUTTON_CLICKED)은 웹에 없는 앱 전용 기능이라, 이 작업 전에는 "유학생의 구독 전환율"을 볼 수 없었습니다.

바뀐 것

  • expo-localization ~17.0.9 추가 (expo install, SDK 54 호환 버전)
  • utils/mixpanel.ts: init() 직후 getLocales()[0].languageTag를 device_locale super property로 등록
    • Locale.current는 쓰지 않습니다. 앱이 선언한 현지화(developmentRegion = en 하나)와 협상된 값이라 기기 언어와 무관하게 en이 될 수 있습니다
    • 등록은 자체 try/catch로 감쌌습니다. init과 같은 try 안에서 throw하면 getMixpanel()이 계속 null이 돼 네이티브 이벤트가 전부 빠집니다
    • 값이 없으면 등록하지 않습니다 (빈 문자열 세그먼트 방지)
  • ios/Podfile.lock, ios/app.xcodeproj/project.pbxproj: pod install 산출물 (ExpoLocalization pod, privacy bundle 복사 줄 2개). RCT-Folly checksum은 Xcode Cloud 값 그대로입니다
  • config plugin은 넣지 않았습니다. 옵션 없이 넣으면 기본값 allowDynamicLocaleChangesAndroid: true로 Android MainActivity configChanges가 바뀝니다

이슈와 다르게 한 것: 웹뷰 window.deviceLocale 주입은 뺐습니다

  • WebKit 소스상 WKWebView의 navigator.language는 호스트 앱의 AppleLanguages(= 기기 선호 언어)를 웹 프로세스로 넘겨받습니다 (LanguageCF.cpp의 CFLocaleCopyPreferredLanguages, AuxiliaryProcessProxyCocoa.mm). 번들 현지화와 협상하지 않으니, 웹 폴백만으로 이미 정확합니다
  • 홈·범용 웹뷰는 injectedJavaScriptBeforeContentLoaded로 학생 토큰을 넣고 있어, 같은 prop을 나눠 쓰다 잘못 합치면 토큰 주입이 깨집니다. 이득 없이 위험만 늘어서 뺐습니다

검증

  • npx tsc --noEmit 통과

  • npm run lint: 오류 0건, 기존 경고 5건 (변경 파일엔 없음)

  • iOS 26.2 시뮬레이터에서 Locale.preferredLanguages(expo가 쓰는 API)를 직접 찍어 확인:

    언어 목록 지역 값
    ko ko_KR ko
    en ko_KR en
    zh-Hans ko_KR zh-Hans
    zh-Hant zh_TW zh-Hant
    새 시뮬레이터 기본값 ko_KR ko-KR

    기기 언어 목록의 첫 값이 가공 없이 나옵니다. 지역 코드는 API가 붙이지 않고, 목록 값에 들어 있을 때만 나옵니다

분석할 때 주의

  • 실기기는 en-KR, zh-Hans-KR처럼 지역이 붙을 수 있습니다. - 앞 언어 코드로 묶어서 보는 게 안전합니다. 중국어는 zh-Hans(간체)/zh-Hant(번체)로 갈립니다
  • 웹 navigator.language는 WebKit이 줄여 쓰므로 같은 사람이라도 웹/앱 값 형식이 다를 수 있습니다
  • 한국어로 폰을 쓰는 유학생은 ko로 잡힙니다. 유학생 수의 하한선으로만 읽어야 합니다

⚠️ 확인 필요

  • dev client 재빌드 필요 (네이티브 모듈 추가. 옛 바이너리로 띄우면 import 시점에 죽습니다). 프로덕션은 OTA가 없어 JS와 바이너리가 같이 나가므로 안전합니다
  • TestFlight에서 기기 언어를 영어/중국어로 바꾼 뒤 Mixpanel 네이티브 이벤트에 device_locale 값 확인
  • Android 회귀 없음 (autolinking만, 네이티브 설정 변경 없음)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • 개선 사항
    • 앱에서 기기의 기본 언어 설정을 더 정확히 반영합니다. 기기에서 확인할 수 있는 언어 정보가 앱 이용 정보에 함께 기록되어, 언어 설정에 따른 이용 현황을 파악하는 데 도움이 됩니다.
    • 언어 정보를 확인할 수 없는 경우에는 해당 정보를 기록하지 않으며, 정보를 처리하는 중 문제가 발생해도 앱 초기화가 중단되지 않습니다.

외국인 유학생 수요를 보려고 웹(Moadong/moadong#1920)은 device_locale을
super property로 이미 수집한다. 앱은 웹과 별개의 Mixpanel 인스턴스를 써서
구독처럼 네이티브에서만 나는 이벤트에는 이 값이 없었다.

- expo-localization의 getLocales()[0].languageTag(iOS Locale.preferredLanguages
  첫 값)를 init 직후 super property로 등록한다. Locale.current는 앱이 선언한
  현지화(en 하나)와 협상된 값이라 기기 언어와 무관하게 en이 될 수 있어 쓰지 않는다
- 등록은 자체 try/catch로 감싼다. init과 같은 try 안에서 throw하면
  getMixpanel()이 계속 null을 돌려줘 네이티브 이벤트가 전부 빠진다
- 값이 없으면 등록하지 않아 빈 문자열 세그먼트를 만들지 않는다
- Podfile.lock, project.pbxproj는 pod install 산출물이다(ExpoLocalization pod,
  privacy bundle 복사 줄)

이슈에 있던 웹뷰 window.deviceLocale 주입은 하지 않는다. WebKit의
navigator.language가 이미 호스트 앱의 AppleLanguages를 읽어 정확도 이득이 없고,
홈·범용 웹뷰의 학생 토큰 주입과 같은 prop을 나눠 써야 해 위험만 늘어난다.

Closes #30

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Files ignored due to path filters: 2

  • ios/Podfile.lock is excluded by !**/*.lock
  • package-lock.json is excluded by !**/package-lock.json
Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 20932524-7da0-495d-9a8f-6cafbb8d6c85
Commits

Reviewing files that changed from the base of the PR and between 045aaa7 and f8c051b.

Files ignored due to path filters: 2

  • ios/Podfile.lock is excluded by !**/*.lock
  • package-lock.json is excluded by !**/package-lock.json

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

expo-localization을 추가했습니다. Mixpanel 초기화 성공 후 기기 선호 언어의 첫 번째 languageTag를 device_locale super property로 등록합니다. iOS 리소스 복사 목록에 ExpoLocalization privacy bundle을 추가했습니다.

Changes

기기 locale 수집

Layer / File(s) Summary
기기 locale 조회 및 Mixpanel 등록
package.json, utils/mixpanel.ts, ios/app.xcodeproj/project.pbxproj
expo-localization을 추가하고 getLocales()의 첫 번째 languageTag가 있을 때 device_locale로 등록합니다. 등록 중 오류는 기록하고 초기화 흐름에 전파하지 않습니다. iOS 리소스 복사 입력 및 출력 목록에 ExpoLocalization_privacy.bundle 경로를 추가합니다.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature · Severity of issue fixed: Medium

Merge Risk: Minimal · previous review 045aa

The app now records the device's preferred language on native analytics events. Failures in this registration are contained and should not interrupt analytics initialization. Before release, confirm the events in TestFlight and check Android. No merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed PR 제목은 네이티브 Mixpanel 이벤트에 기기 언어(device_locale) 속성을 추가한다는 핵심 변경을 정확히 설명합니다. 변경 내용은 expo-localization 추가, utils/mixpanel.ts의 registerDeviceLocale 추가, Xcode 프로젝트의 리소스 경로 추가이며, 제목과 모두 관련됩니다. 제목은 한국어로 작성되어…
Linked Issues check Passed [#30] 직접 연결된 활성 이슈의 핵심 코딩 요구사항은 충족됩니다.

1. expo-localization 설치: package.json에 expo-localization ~17.0.9가 추가되었습니다. 이슈의 체크리스트 항목과 일치합니다.
2. 네이티브 Mixpanel super property 등록: utils/mixpanel.ts의 init 직후 r…
Out of Scope Changes check Passed 변경 사항은 모두 #30 구현과 직접 연결됩니다.

- package.json: expo-localization ~17.0.9 의존성 추가. 요구사항 1과 일치합니다.
- utils/mixpanel.ts: registerDeviceLocale 추가 및 init 직후 호출. 요구사항 2와 일치합니다.
- ios/app.xcodeproj/project.pbxp…
Full details: Title check

Explanation

PR 제목은 네이티브 Mixpanel 이벤트에 기기 언어(device_locale) 속성을 추가한다는 핵심 변경을 정확히 설명합니다. 변경 내용은 expo-localization 추가, utils/mixpanel.ts의 registerDeviceLocale 추가, Xcode 프로젝트의 리소스 경로 추가이며, 제목과 모두 관련됩니다. 제목은 한국어로 작성되어 있고 한 문장이며, 길이도 적절합니다.

Full details: Linked Issues check

Explanation

[#30] 직접 연결된 활성 이슈의 핵심 코딩 요구사항은 충족됩니다.

  1. expo-localization 설치: package.json에 expo-localization ~17.0.9가 추가되었습니다. 이슈의 체크리스트 항목과 일치합니다.
  2. 네이티브 Mixpanel super property 등록: utils/mixpanel.ts의 init 직후 registerDeviceLocale가 getLocales()[0]의 languageTag를 device_locale로 등록합니다. 값이 없으면 등록하지 않습니다. 등록 오류는 자체 try/catch로 처리하여 init 흐름에 전파하지 않습니다. 이슈 요구사항을 충족합니다.
  3. WebView window.deviceLocale 주입: 이번 PR에는 포함되지 않습니다. 이슈는 이 항목을 "정확도 개선용이며 폴백이 있으므로 선택"으로 명시합니다. PR 설명은 WebKit이 navigator.language에 기기 선호 언어를 반영한다고 주장하며, 이 주장은 이번 검토에서 검증하지 않았습니다. 이슈의 긴급도와 선택 항목 표시를 고려하면 이 제외는 이슈 요구사항 위반으로 보지 않습니다.

이슈가 명시한 비코딩 항목(dev client 재빌드, TestFlight에서 Mixpanel 이벤트 확인, Android 회귀 확인)은 평가 대상이 아닙니다.

Full details: Out of Scope Changes check

Explanation

변경 사항은 모두 #30 구현과 직접 연결됩니다.

  • package.json: expo-localization ~17.0.9 의존성 추가. 요구사항 1과 일치합니다.
  • utils/mixpanel.ts: registerDeviceLocale 추가 및 init 직후 호출. 요구사항 2와 일치합니다.
  • ios/app.xcodeproj/project.pbxproj: ExpoLocalization_privacy.bundle 복사 단계 2줄 추가. expo-localization 설치에 따른 pod install 산출물이므로 의존성 결과로 설명됩니다.
  • ios/Podfile.lock 및 package-lock.json: 제외 대상 파일입니다. 이 파일의 내용은 검토하지 않았으며, 이 판정의 근거로 사용하지 않았습니다.

config plugin을 추가하지 않은 판단은 Android MainActivity 설정 변경을 피하기 위한 것입니다. 이는 범위 밖 변경이 아니라 범위를 줄인 결정입니다. 확인된 범위 밖 변경은 없습니다.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ff17589f-f26c-4e22-9423-50322dc4a5cd
Commits

Reviewing files that changed from the base of the PR and between ff9e37f and 045aaa7.

Files ignored due to path filters: 2

  • ios/Podfile.lock is excluded by !**/*.lock
  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing: 3

  • ios/app.xcodeproj/project.pbxproj
  • package.json
  • utils/mixpanel.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@seongwon030
seongwon030 merged commit 152d26c into main Nov 21, 2026
2 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Nov 21, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] device_locale 수집 - 네이티브 Mixpanel 등록 및 WebView 주입

1 participant