廣告活動評估 - iOS SDK

本文件將概略介紹如何使用 iOS 專用的 Google Analytics (分析) SDK v3,評估廣告活動和流量來源。

總覽

透過 Google Analytics (分析) 評估廣告活動,您就能將廣告活動和流量來源歸因於應用程式內的使用者活動。下列選項適用於 iOS 專用 Google Analytics (分析) SDK 中的廣告活動和流量來源歸因:

以下各節將說明在應用程式中導入各類型廣告活動評估的時機和方式。

廣告活動參數

廣告活動參數的作用是針對將使用者帶往應用程式的流量來源和廣告活動,傳遞相關資訊。

下表列出可用於一般廣告活動評估的可用廣告活動參數:

參數 說明 範例
utm_campaign 廣告活動名稱;用於關鍵字分析,找出特定產品宣傳或策略性廣告活動 utm_campaign=spring_sale
utm_source 廣告活動來源;用來識別搜尋引擎、電子報或其他來源 utm_source=google
utm_medium 廣告活動媒介;用來識別電子郵件或單次點擊出價等媒介 utm_medium=cpc
utm_term 廣告活動字詞;搭配付費搜尋使用,以提供廣告的關鍵字 utm_term=running+shoes
utm_content 廣告活動內容;用於 A/B 測試和指定內容廣告,以區分連到同一個網址的廣告或連結 utm_content=logolink
utm_content=textlink
gclid Google Ads 自動標記參數;用於評估廣告。這個值是動態產生,請勿修改。

一般廣告活動與流量來源歸因

應用程式安裝完成後,廣告活動、網站或其他應用程式的參照連結網址可能會啟動。在這種情況下,您可以直接在追蹤程式上設定廣告活動欄位,將參照流量來源或行銷廣告活動歸因於後續工作階段的使用者活動。

傳送廣告活動資料最簡單的方法是使用 [GAIDictionaryBuilder setCampaignParametersFromUrl:urlString],其中 urlString 字串代表可能含有 Google Analytics (分析) 廣告活動參數的網址。請注意,在以下範例中,廣告活動資料只需要傳送一次,因此不會直接在追蹤器上設定:

/*
 * MyAppDelegate.m
 *
 * An example of how to implement campaign and referral attribution.
 * If no Google Analytics campaign parameters are set in the referring URL,
 * use the hostname as a referrer instead.
 */

// For iOS 9.0 and later
- (BOOL)application:(UIApplication *)app openURL:(nonnull NSURL *)url
            options:(nonnull NSDictionary<NSString *,id> *)options {

// For iOS versions prior to 9.0
//- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
//  sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {

  NSString *urlString = [url absoluteString];

  id<GAITracker> tracker = [[GAI sharedInstance] trackerWithName:@"tracker"
                                                      trackingId:@"UA-XXXX-Y"];

  // setCampaignParametersFromUrl: parses Google Analytics campaign ("UTM")
  // parameters from a string url into a Map that can be set on a Tracker.
  GAIDictionaryBuilder *hitParams = [[GAIDictionaryBuilder alloc] init];

  // Set campaign data on the map, not the tracker directly because it only
  // needs to be sent once.
  [hitParams setCampaignParametersFromUrl:urlString];

  // Campaign source is the only required campaign field. If previous call
  // did not set a campaign source, use the hostname as a referrer instead.
  if(![hitParams get:kGAICampaignSource] && [url host].length !=0) {
    // Set campaign data on the map, not the tracker.
    [hitParams set:@"referrer" forKey:kGAICampaignMedium];
    [hitParams set:[url host] forKey:kGAICampaignSource];
  }

  NSDictionary *hitParamsDict = [hitParams build];

  // A screen name is required for a screen view.
  [tracker set:kGAIScreenName value:@"screen name"];

  // Previous V3 SDK versions.
  // [tracker send:[[[GAIDictionaryBuilder createAppView] setAll:hitParamsDict] build]];

  // SDK Version 3.08 and up.
  [tracker send:[[[GAIDictionaryBuilder createScreenView] setAll:hitParamsDict] build]];

此外,如果您的廣告活動資訊形式不是 Google Analytics (分析) 廣告活動參數,則可在 NSDictionary 上設定,並手動傳送:

// Assumes at least one tracker has already been initialized.
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];

// Note that it's not necessary to set kGAICampaignKeyword for this email campaign.
NSDictionary *campaignData = [NSDictionary dictionaryWithObjectsAndKeys:
    @"email", kGAICampaignSource,
    @"email_marketing", kGAICampaignMedium,
    @"summer_campaign", kGAICampaignName,
    @"email_variation1", kGAICampaignContent, nil];

// A screen name is required for a screen view.
[tracker set:kGAIScreenName value:@"screen name"];

// Note that the campaign data is set on the Dictionary, not the tracker.
// Previous V3 SDK versions.
// [tracker send:[[[GAIDictionaryBuilder createAppView] setAll:campaignData] build]];

// SDK Version 3.08 and up.
[tracker send:[[[GAIDictionaryBuilder createScreenView] setAll:campaignData] build]];

iOS 安裝廣告活動評估

Google Analytics (分析) 針對熱門聯播網提供立即可用的 iOS 安裝廣告活動評估支援,可針對其他聯播網產生自訂網址。

若要啟用 iOS 安裝廣告活動評估功能,請使用下方的 iOS 廣告活動追蹤網址產生器,針對將使用者帶往 App Store 的廣告產生到達網頁網址。為了讓 iOS 廣告活動追蹤能順利運作,您必須先在 iOS 應用程式中導入 Google Analytics (分析)、啟用廣告識別碼收集功能,並在應用程式中追蹤一或多個畫面瀏覽或事件。如要使用自動 iAd 安裝廣告活動評估,您也必須在應用程式中加入額外架構。

適用於 iOS 轉換追蹤的自助式診斷

如果沒看到 iOS 廣告活動的轉換次數,請按照下列步驟解決問題:

  1. 確認 iOS 廣告活動追蹤功能已啟用
  2. 確認申請 ID 相符
  3. 確認 Google Analytics (分析) SDK 正在傳送廣告識別碼
  4. 查看客層報表,確認廣告識別碼已送出
  5. 確認 iOS 廣告活動追蹤網址正確無誤

步驟 1:確認 iOS 廣告活動追蹤功能已啟用

如何確認目標資源已啟用 iOS 廣告活動追蹤功能:

  1. 按一下「管理」分頁標籤。

    「管理」分頁

  2. 選取資源並按一下「資源設定」。

    資源設定

  3. 確認「iOS 廣告活動追蹤」已開啟

    iOS 廣告活動追蹤

步驟 2:確認申請 ID 相符

為了正確歸因含有應用程式資料的廣告活動, iOS 廣告活動追蹤網址和應用程式追蹤導入作業必須使用相同的應用程式 ID。如要找出目前所追蹤應用程式的應用程式 ID,請在 Google Analytics (分析) 網頁介面中,建立含有「應用程式 ID」維度和「工作階段」指標的自訂報表。

建立點擊 iOS 廣告活動追蹤網址時,請使用自訂報表中顯示的應用程式 ID

建立自訂報表

步驟 3:確認 Google Analytics (分析) SDK 正在傳送廣告識別碼

Google Analytics (分析) 使用廣告客戶識別碼 (IDFA) 做為連結行動點擊與 Google Analytics (分析) 命中的鍵。請確認下列事項:

  • 應用程式使用 iOS 版 Google Analytics (分析) SDK 3.10 以上版本。
  • 如果使用 獨立 SDK 下載
    • Google Analytics (分析) iOS 版本中,您的應用程式已與 libAdIdAccess.a 連結。
    • 您的應用程式已連結至 AdSupport.framework
  • 如果您使用 CocoaPods 安裝及管理依附元件,請將 GoogleIDFASupport Cocoapod 新增至 Podfile:
    pod 'GoogleIDFASupport'
    
  • 您已為每個追蹤程式啟用廣告識別碼收集功能:
    tracker.allowIDFACollection = YES;
    
  • 請盡可能使用偵錯 Proxy 應用程式查看 HTTP 要求,並確認廣告已納入 IDFA。

步驟 4:查看客層報表,確認廣告識別碼已送出

Google Analytics (分析) 使用 IDFA 產生客層報表。 在 Google Analytics (分析) 中,按一下「報表」分頁標籤,然後依序點選「目標對象」>「客層」>「總覽」,看看是否看到客層資料。否則,系統會正確傳送廣告識別碼。

自訂報表

步驟 5:確認 iOS 廣告活動追蹤網址正確無誤

請使用 iOS 廣告活動追蹤網址產生器,確認 iOS 廣告活動追蹤網址正確無誤。

選取廣告聯播網的「自訂」選項時,請務必也與該聯播網聯絡,確認該聯播網是否支援使用重新導向網址追蹤個別裝置 ID。如果沒有,Google Analytics (分析) 報表將不會顯示任何資料。

iOS 廣告活動追蹤網址產生器

請使用下列工具產生網址,評估 iOS 應用程式安裝來源。