모바일 앱 구현 가이드

이 문서는 모바일 개발자를 대상으로 하며, Google 애널리틱스를 사용하여 사용자 상호작용을 측정하고 앱 사용에 관한 질문에 답변하는 방법을 설명합니다.

소개

모바일 앱용 Google 애널리틱스는 사용자 상호작용을 측정하는 플랫폼을 제공하므로 앱의 사용자 참여를 더 잘 이해하고 최적화할 수 있습니다.

Google 애널리틱스의 기본 구현에서는 앱에 대한 다음 정보를 자동으로 제공합니다.

  • 사용자 수 및 세션수
  • 세션 시간
  • 운영체제
  • 기기 모델
  • 지역

이 가이드에서는 Google 애널리틱스 추가 기능을 구현하여 사용자와 사용자의 행동을 더 잘 이해하는 방법을 설명합니다.

시작하기 전에

이 가이드를 진행하기 전에 아래 리소스를 검토하여 모바일 앱용 Google 애널리틱스를 설정하는 방법을 알아보세요.

개요

드래곤 캐처

이 가이드에서는 샘플 앱을 사용하여 추가 Google 애널리틱스 기능을 구현하는 과정을 안내합니다. 앱의 이름은 Dragon Catcher이며 다음과 같은 게임플레이 특성을 가지고 있습니다.

  • 레벨은 플레이어, 드래곤, 울타리가 쳐진 지역, 우물, 나무로 이루어집니다.
  • 플레이어의 목표는 울타리가 쳐진 지역으로 드래곤을 이동하여 잡는 것입니다.
  • 플레이어는 레벨의 여러 영역과 우물이나 마법 나무 같은 사물을 방문할 수 있습니다.
  • 드래곤을 모두 잡으면 다음 레벨로 올라갑니다.
  • 플레이어가 첫 번째 레벨인 Barren fields에서 게임을 시작합니다.

Google 애널리틱스를 사용하면 Dragon Catcher와 관련된 사용자 행동 관련 질문에 대한 답을 얻을 수 있습니다.

이 문서의 나머지 부분에서는 Dragon Catcher 게임에 Google 애널리틱스 기능을 구현하여 이러한 질문에 대한 답을 찾는 방법을 설명합니다.

사용자가 어떤 액션을 취하고 있나요? (이벤트)

앱 내에서 추적하려는 중요 액션이 있는 경우 이벤트를 사용하여 Google 애널리틱스에서 이 액션을 설명할 수 있습니다. 이벤트는 category, action, label, value의 4가지 매개변수로 구성됩니다. Google 애널리틱스의 이벤트 작동 방식에 관한 자세한 내용은 이벤트 추적의 구조를 참고하세요.

예를 들어 Dragon Catcher에서 사용자가 드래곤을 구조하거나 레벨의 특정 영역을 방문하는 것은 이벤트를 사용하여 측정하려는 중요한 작업입니다. 아래의 코드 스니펫은 Google 애널리틱스에서 이를 측정하는 방법을 보여줍니다.

Android SDK v4

// To determine how many dragons are being rescued, send an event when the
// player rescues a dragon.
tracker.send(new HitBuilders.EventBuilder()
    .setCategory("Barren Fields")
    .setAction("Rescue")
    .setLabel("Dragon")
    .setValue(1)
    .build());

// To determine if players are visiting the magic tree, send an event when the
// player is in the vicinity of the magic tree.
tracker.send(new HitBuilders.EventBuilder()
    .setCategory("Barren Fields")
    .setAction("Visited")
    .setLabel("Magic Tree")
    .setValue(1)
    .build());

// To determine if players are visiting the well, send an event when the player
// is in the vicinity of the well.
tracker.send(new HitBuilders.EventBuilder()
    .setCategory("Barren Fields")
    .setAction("Visited")
    .setLabel("Well")
    .setValue(1)
    .build());

iOS SDK v3

// To determine how many dragons are being rescued, send an event when the
// player rescues a dragon.
[tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"Barren Fields"
                                                      action:@"Rescue"
                                                       label:@"Dragon"
                                                       value:@1] build]];

// To determine if players are visiting the magic tree, send an event when the
// player is in the vicinity of the magic tree.
[tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"Barren Fields"
                                                      action:@"Visited"
                                                       label:@"Magic Tree"
                                                       value:@1] build]];

// To determine if players are visiting the well, send an event when the player
// is in the vicinity of the well.
[tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"Barren Fields"
                                                      action:@"Visited"
                                                       label:@"Well"
                                                       value:@1] build]];

Unity v3용 GA 플러그인

// To determine how many dragons are being rescued, send an event when the
// player rescues a dragon.
googleAnalytics.LogEvent("Barren Fields", "Rescue", "Dragon", 1);

// To determine if players are visiting the magic tree, send an event when the
// player is in the vicinity of the magic tree.
googleAnalytics.LogEvent("Barren Fields", "Visited", "Magic Tree", 1);

// To determine if players are visiting the well, send an event when the player
// is in the vicinity of the well.
googleAnalytics.LogEvent("Barren Fields", "Visited", "Well", 1);

플레이어의 '업적' 측정

플레이어의 '업적'은 Google 애널리틱스의 이벤트를 사용하여 측정할 수 있습니다. 예를 들어 드래곤 5명을 구하기 위한 업적을 측정하기 위해 플레이어가 구한 드래곤 수가 기록되고 플레이어가 기준점에 도달하면 이벤트가 Google 애널리틱스로 전송됩니다.

Android SDK v4

if (numDragonsRescued > 5) {
  if (!user.hasAchievement(RESCUED_ACHIEVEMENT) {
    tracker.send(new HitBuilders.EventBuilder()
        .setCategory("Achievement")
        .setAction("Unlocked")
        .setLabel("5 Dragons Rescued")
        .setValue(1)
        .build());
  } else {
    tracker.send(new HitBuilders.EventBuilder()
        .setCategory("Achievement")
        .setAction("Earned")
        .setLabel("5 Dragons Rescued")
        .setValue(1)
        .build());
  }
}

iOS SDK v3

if (numDragonsRescued > 5) {
  if (![user hasAchievement:RESCUED_ACHIEVEMENT]) {
    [tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"Achievement"
                                                          action:@"Unlocked"
                                                           label:@"5 Dragons Rescued"
                                                           value:@1] build]];
  } else {
    [tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"Achievement"
                                                          action:@"Earned"
                                                           label:@"5 Dragons Rescued"
                                                           value:@1] build]];
  }
}

Unity v3용 GA 플러그인

if (numDragonsRescued > 5) {
  if (!user.HasAchievement(RESCUED_ACHIEVEMENT) {
    googleAnalytics.LogEvent("Achievement", "Unlocked", "5 Dragons Rescued", 1);
  } else {
    googleAnalytics.LogEvent("Achievement", "Earned", "5 Dragons Rescued", 1);
  }
}

이벤트 개발자 가이드

이벤트 보고

이벤트 데이터는 다음에서 사용할 수 있습니다.

사용자가 내 앱에서 지출하는 금액은 얼마인가요? (향상된 전자상거래)

사용자의 인앱 구매를 측정하려면 전자상거래 추적을 사용하여 구매를 추적하고 관련 제품 실적과 사용자 행동을 파악할 수 있습니다. 전자상거래 추적은 특정 항목이나 가상 통화의 구매를 측정하는 데 사용할 수 있습니다.

예를 들어 Dragon Catcher에서는 일부 항목의 구매를 측정하기 위해 거래 데이터가 이벤트와 함께 Google 애널리틱스로 전송됩니다.

Android SDK v4

Product product = new Product()
    .setName("Dragon Food")
    .setPrice(40.00);

ProductAction productAction = new ProductAction(ProductAction.ACTION_PURCHASE)
    .setTransactionId("T12345");

// Add the transaction data to the event.
HitBuilders.EventBuilder builder = new HitBuilders.EventBuilder()
    .setCategory("In-Game Store")
    .setAction("Purchase")
    .addProduct(product)
    .setProductAction(productAction);

// Send the transaction data with the event.
tracker.send(builder.build());

iOS SDK v3

GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init];
[product setName:@"Dragon Food"];
[product setPrice:@40.00];

GAIEcommerceProductAction *productAction = [[GAIEcommerceProductAction alloc] init];
[productAction setAction:kGAIPAPurchase];
[productAction setTransactionId:@"T12345"];

GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createEventWithCategory:@"In-Game Store"
                                                                       action:@"Purchase"
                                                                        label:nil
                                                                        value:nil];
// Add the transaction data to the event.
[builder setProductAction:productAction];
[builder addProduct:product];

// Send the transaction data with the event.
[tracker send:[builder build]];

Unity v3용 GA 플러그인

// Note: Using Android SDK v3 and standard Ecommerce tracking.

googleAnalytics.LogItem("T12345", "Dragon Food", "Food_SKU", "Items", 40.00, 1);
googleAnalytics.LogTransaction("T12345", "In-Game Store", 40.00, 0.00, 0.00);

사용자가 가상 화폐를 구매하면 거래 데이터를 Google 애널리틱스로 전송할 때 실제 현금 교환을 측정하는 것이 좋습니다. 사용자가 가상 화폐를 사용하여 상품을 구매할 때 이벤트를 사용하여 이를 측정합니다. 예를 들면 다음과 같습니다.

Android SDK v4

/**
 * When the user purchases the virtual currency (Gems) measure the transaction
 * using enhanced ecommerce.
 */
Product product =  new Product()
    .setName("2500 Gems")
    .setPrice(5.99);

ProductAction productAction = new ProductAction(ProductAction.ACTION_PURCHASE)
    .setTransactionId("T67890");

// Add the transaction to the screenview.
HitBuilders.ScreenViewBuilder builder = new HitBuilders.ScreenViewBuilder()
    .addProduct(product)
    .setProductAction(productAction);

// Send the transaction with the screenview.
tracker.setScreenName("In-Game Store");
tracker.send(builder.build());


/**
 * When the user purchases an item using the virtual currency (Gems) send an
 * event to measure this in Google Analytics.
 */
HitBuilders.EventBuilder builder = new HitBuilders.EventBuilder()
    .setCategory("In-Game Store")
    .setAction("Purchase")
    .setLabel("Sword")
    .setValue(35);
tracker.send(builder.build());

iOS SDK v3

/**
 * When the user purchases the virtual currency (Gems) measure the transaction
 * using enhanced ecommerce.
 */
GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init];
[product setName:@"2500 Gems"];
[product setPrice:@5.99];

GAIEcommerceProductAction *productAction = [[GAIEcommerceProductAction alloc] init];
[productAction setAction:kGAIPAPurchase];
[productAction setTransactionId:@"T67890"];

GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView];

// Add the transaction data to the screenview.
[builder setProductAction:productAction];
[builder addProduct:product];

// Send the transaction with the screenview.
[tracker set:kGAIScreenName value:@"In-Game Store"]
[tracker send:[builder build]];


/**
 * When the user purchases an item using the virtual currency (Gems) send an
 * event to measure this in Google Analytics.
 */
GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createEventWithCategory:@"In-Game Store"
                                                                       action:@"Purchase"
                                                                        label:@"Sword"
                                                                        value:@35];
[tracker send:[builder build]];

Unity v3용 GA 플러그인

// Note: Using Android SDK v3 and standard Ecommerce tracking.

/**
 * When the user purchases the virtual currency (Gems) measure the transaction
 * using enhanced ecommerce.
 */

googleAnalytics.LogItem("T12345", "2500 Gems", "GEM2500_SKU", "Items", 5.99, 1);
googleAnalytics.LogTransaction("T12345", "In-Game Store", 5.99, 0.00, 0.00);

/**
 * When the user purchases an item using the virtual currency (Gems) send an
 * event to measure this in Google Analytics.
 */
googleAnalytics.LogEvent("In-Game Store", "Purchase", "Sword", 35);

향상된 전자상거래를 위한 개발자 가이드

향상된 전자상거래 보고서

전자상거래 데이터는 다음 국가에서 사용할 수 있습니다.

사용자가 내 앱 목표를 달성하고 있나요? (목표)

사용자가 완료했으면 하는 앱 목표가 있는 경우 Google 애널리틱스에서 목표를 사용하여 이러한 목표를 정의하고 측정할 수 있습니다. 예를 들어 사용자가 특정 게임 레벨에 도달하거나 아이템을 구매하는 것이 목표일 수 있습니다. 목표의 작동 방식에 관한 자세한 내용은 목표 정보 (고객센터)를 참고하세요.

Dragon Catcher 게임에서는 각 구매에 대한 이벤트가 Google 애널리틱스로 전송되는 경우 인앱 구매가 이루어지는 시점을 측정하도록 목표를 설정할 수 있습니다. 목표는 추가 코드 없이 다음 매개변수를 사용하여 웹 인터페이스 관리자에서 정의할 수 있습니다.

  • 목표 유형 (같음): 이벤트
  • 카테고리 (동일): 인게임 스토어
  • 액션 (같음): 구매
  • 전환 목표값으로 이벤트 값 사용:

목표 보고

목표 데이터는 다음에서 사용할 수 있습니다.

특정 특성을 가진 사용자는 어떻게 행동하나요? (맞춤 측정기준 및 측정항목)

특정 속성/특성/메타데이터가 있는 사용자를 추적하려면 맞춤 측정기준을 사용하여 이러한 유형의 데이터를 Google 애널리틱스 및 분석에 전송할 수 있습니다. 맞춤 측정기준의 작동 방식에 대한 자세한 내용은 맞춤 측정기준 및 측정항목 기능 참조를 참고하세요.

예를 들어 Dragon Catcher에서 첫 번째 수준, 두 번째 수준 등에 있는 사용자의 비율을 찾으려면 맞춤 측정기준을 사용자의 현재 수준으로 설정하고 Google 애널리틱스로 전송할 수 있습니다. 단계는 다음과 같습니다.

  1. User 범위로 맞춤 측정기준을 만듭니다. 이 값은 사용자의 모든 세션에서 유지되어야 하므로 User 범위가 사용됩니다. 맞춤 측정기준 설정 또는 수정 (고객센터)을 참고하세요.
  2. 사용자 수준이 변경된 경우 맞춤 측정기준 값을 업데이트합니다.

다음 스니펫은 사용자 수준의 맞춤 측정기준 색인이 1이고 사용자 수준이 Barren Fields로 변경된 Google 애널리틱스에서 사용자의 상태를 업데이트하는 방법을 보여줍니다.

Android SDK v4

// Set the user level custom dimension when sending a hit to Google Analytics
// such as a screenview or event.
tracker.setScreen("BarrenFields");
tracker.send(new HitBuilders.ScreenViewBuilder()
    .setCustomDimension(1, "Barren Fields")
    .build()
);

iOS SDK v3

// Set the user level custom dimension when sending a hit to Google Analytics
// such as a screenview or event.
[tracker set:kGAIScreenName value:@"BarrenFields"];
[tracker send:[[[GAIDictionaryBuilder createScreenView]
         set:@"Barren Fields"
      forKey:[GAIFields customDimensionForIndex:1]] build]];

Unity v3용 GA 플러그인

// Set the user level custom dimension when sending a hit to Google Analytics
// such as a screenview or event.
googleAnalytics.LogScreen(new AppViewHitBuilder()
    .SetScreenName("BarrenFields").SetCustomDimension(1, "Barren Fields"));

맞춤 측정기준 및 측정항목에 관한 개발자 가이드

맞춤 측정기준 및 측정항목 보고서

맞춤 측정기준을 세그먼트에 포함하고 적용하여 다음과 같은 용도로 사용할 수 있습니다.

맞춤 측정기준을 세그먼트로 적용하면 게임 내 특정 레벨에 있는 사용자를 분석할 수 있습니다.

사용자가 작업을 수행하는 데 시간이 얼마나 걸리나요? (맞춤 시간)

앱에서 작업을 완료하는 데 걸리는 시간을 측정하려는 경우 Google 애널리틱스에서 시간 기반 측정에 사용자 시간을 사용할 수 있습니다. 사용자 타이밍은 이벤트와 비슷하지만 시간을 기준으로 하며 category, value, name (variable), label를 포함할 수 있습니다. 사용자 시간 작동 방식에 대해 자세히 알아보려면 사이트 속도 정보를 참조하세요.

예를 들어 Dragon Catcher에서 사용자가 첫 번째 드래곤을 구하는 데 걸리는 시간을 측정하기 위해 다음과 같이 보낼 수 있습니다.

Android SDK v4

// Build and send a timing hit.
tracker.send(new HitBuilders.TimingBuilder()
    .setCategory("Barren Fields")
    .setValue(45000)  // 45 seconds.
    .setVariable("First Rescue")
    .setLabel("Dragon")
    .build());

iOS SDK v3

[tracker send:[[GAIDictionaryBuilder createTimingWithCategory:@"Barren Fields"
                                                     interval:@45000   // 45 seconds.
                                                         name:@"First Rescue"
                                                        label:@"Dragon"] build]];

Unity v3용 GA 플러그인

// Build and send a timing hit.
googleAnalytics.LogTiming("Barren Fields",45000,"First Rescue","Dragon");

맞춤 타이밍에 관한 개발자 가이드

맞춤 시간 보고

맞춤 시간 데이터는 다음에서 사용할 수 있습니다.

  • 애널리틱스 아카데미 - 모바일 앱 애널리틱스 기본사항을 포함한 무료 온라인 과정을 통해 애널리틱스 기술을 향상할 수 있습니다.
  • 수집 API 및 SDK - Google 애널리틱스로 데이터를 전송하는 모든 방법에 대해 알아보세요.