모바일 앱 구현 가이드

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

소개

모바일 앱용 Google 애널리틱스는 사용자 상호작용을 더욱 정확하게 파악하고 앱과의 상호작용을 최적화할 수 있는 플랫폼을 제공합니다.

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

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

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

시작하기 전에

이 가이드를 살펴보기 전에 아래 리소스를 검토하여 모바일 앱용 Google 애널리틱스를 설정하는 방법을 알아보는 것이 좋습니다.

개요

드래곤 캐처

이 가이드에서는 샘플 앱을 사용하여 Google 애널리틱스 추가 기능을 구현하는 방법을 설명합니다. Dragon Catcher라는 앱은 다음과 같은 게임플레이 특성을 갖습니다.

  • 레벨은 플레이어, 드래곤, 펜스 구역, 우물, 나무로 구성됩니다.
  • 플레이어의 목표는 용을 울타리 영역으로 이동하여 잡는 것입니다.
  • 플레이어는 우물 또는 마법의 나무와 같은 레벨의 다양한 영역과 물건을 방문할 수 있습니다.
  • 모든 드래곤을 잡으면 플레이어가 다음 레벨로 진행합니다.
  • 플레이어가 첫 번째 레벨인 배런 필즈에서 게임을 시작합니다.

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용 GA 플러그인 v3

// 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용 GA 플러그인 v3

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용 GA 플러그인 v3

// 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용 GA 플러그인 v3

// 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용 GA 플러그인 v3

// 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용 GA 플러그인 v3

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

맞춤 시간 관련 개발자 가이드

맞춤 시간 보고

맞춤 시간 데이터는 다음 언어로 제공됩니다.

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