IDGraph iOS Tracking Code
於 2024年10月22日 (二) 07:30 由 CharlesWang(留言 | 貢獻) 所做的修訂
回報追蹤
在AppDelegate的didFinishLaunchingWithOptions function 中,帶入 Service ID 初始化 TAMIdGraphManager 即可完成追蹤碼的建置。
其中Service id就是TAMedia提供給您的服務id。
請參考以下範例
Swift
在AppDelegate.swift內實作
import UIKit
import TAMIdGraph
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
TAMIdGraphManager.initTAMIdGraphManager(withServiceId:"Your Service Id")
return true
}
}
完成以上步驟即完成追蹤碼的設置
回報客製化參數
要回報客製化參數則使用以下兩方法,傳入參數可為中、英、數或混合 1.只帶入一客製化參數
+(void)initWithServiceId:(NSString *)serviceId customParameter:(NSString*)parameter;
2.帶入多個客製化參數(上限為12個字串)
+ (void)initWithServiceId:(NSString *)serviceId customParameters:(NSArray*)parameters;
請參考以下範例:
//回傳兩個參數
func reportOneParams() {
TAMIdGraphManager.initWithServiceId("YourServiceID", customParameter:
"param1")
}
//回傳多個參數
func reportCustomParams() {
TAMIdGraphManager.initWithServiceId("YourServiceID", customParameters:
["param1", "param2"])