튜토리얼: iOS 광고 전환 측정

1단계: 로그인 환경 구현


소개: iOS 광고 전환 측정

1단계: 로그인 환경 구현

2단계: Google Analytics 통합
3단계: Google Analytics을 사용하여 온디바이스 전환 측정 시작하기
4단계: 일반적인 문제 해결 및 처리


첫 번째 단계는 사용자가 이메일 주소나 전화번호를 제공할 수 있도록 로그인 환경을 구현하는 것입니다.

사용하는 인증 시스템은 사용자와 연결된 이메일 주소 또는 전화번호를 제공해야 합니다. 다음 단계에서는 Firebase Authentication를 사용하여 로그인 정보를 안전하게 수집하는 프로세스를 설명합니다. 하지만 사용자 이메일 또는 전화번호를 수집하는 인증 시스템이 이미 있는 경우 이 단계를 건너뛰고 2단계: Google 애널리틱스 통합으로 계속 진행할 수 있습니다.

인증 시스템 설정

Firebase Authentication 로그인 방법 사용

Firebase Authentication을 사용하면 사용자가 앱에 로그인할 때 이메일 주소, 전화번호, 비밀번호를 통한 로그인 방법이나 제휴 ID 공급업체 (예: Google, Facebook, Twitter)를 통한 로그인 등 1개 이상의 로그인 방법을 사용하여 로그인할 수 있습니다. Firebase Authentication 시작하기를 검토하세요.

Firebase Authentication을 맞춤 인증 시스템과 통합

또는 사용자가 정상적으로 로그인할 때 커스텀 서명 토큰을 발행하도록 인증 서버를 수정하여 Firebase Authentication에 커스텀 인증 시스템을 통합할 수 있습니다. 그러면 앱이 이 토큰을 받아 Firebase 인증에 사용합니다. 맞춤 인증 시스템 시작하기를 검토하세요.

인증된 사용자의 이메일 주소 또는 전화번호 가져오기

Firebase Authentication로 인증 시스템을 설정한 후 현재 로그인한 사용자를 가져올 수 있습니다.

현재 사용자를 가져올 때 권장하는 방법은 Auth 객체에 리스너를 설정하는 것입니다.

Swift

handle = Auth.auth().addStateDidChangeListener { auth, user in
  // Get the user's email address
  let email = user.email
  // or get their phone number
  let phoneNumber = user.phoneNumber
  // ...
}

Objective-C

self.handle = [[FIRAuth auth]
  addAuthStateDidChangeListener:^(FIRAuth *_Nonnull auth, FIRUser *_Nullable user) {
    // Get the user's email address
    NSString *email = user.email;
    // or get their phone number
    NSString *phoneNumber = user.phoneNumber;
    // ...
  }];

Unity

Firebase.Auth.FirebaseAuth auth;
Firebase.Auth.FirebaseUser user;

// Handle initialization of the necessary firebase modules:
void InitializeFirebase() {
  auth = Firebase.Auth.FirebaseAuth.DefaultInstance;
  auth.StateChanged += AuthStateChanged;
  AuthStateChanged(this, null);
}

// Track state changes of the auth object.
void AuthStateChanged(object sender, System.EventArgs eventArgs) {
  if (auth.CurrentUser != user) {
    bool signedIn = user != auth.CurrentUser && auth.CurrentUser != null;
    user = auth.CurrentUser;
    if (signedIn) {
      // Get the user's email address
      string email = user.Email;
      // or get their phone number
      string phoneNumber = user.PhoneNumber;
      // ...
    }
  }
}

// Handle removing subscription and reference to the Auth instance.
// Automatically called by a Monobehaviour after Destroy is called on it.
void OnDestroy() {
  auth.StateChanged -= AuthStateChanged;
  auth = null;
}




소개 2단계: Google Analytics 통합