Apps Kit SDK logoApps Kit SDK
ドキュメント · iOS への組み込み

6. AKS イベントとログ

6.1 ログ記録とイベント

swift
// Free-form debug log
AKSLogManager.shared.log(type: AppsKitSDKLogType.info, message: "Sync finished")

// Named log with a name + type + message
AKSLogManager.shared.log(name: "MyTag", type: AppsKitSDKLogType.warning, message: "Cache stale")

// AKS event tied to a screen context
AKSLogManager.shared.log(context: PlatformContext(delegate: nil), eventName: "e_home_btn_save")

// Same thing, built from screenId/eventType/name instead of a hand-rolled string
AKSLogManager.shared.log(
    context: PlatformContext(delegate: viewController),
    eventName: AKSEventCreator.shared.createEvent(screenId: screenId, eventType: AppsKitSDKEventType.screen, name: name)
)

// Fire a named Firebase event with parameters, from anywhere
AKSLogManager.shared.sendEvent(eventName: "custom_event_name", params: ["key": "value"])

// Purchase / subscription events
AKSLogManager.shared.sendPurchaseEvent(
    context: PlatformContext(delegate: nil),
    purchaseType: PurchaseType.subscription, // or .inApp
    productId: "premium_monthly",
    price: 4.99,
    currency: "USD",
    receiptId: receipt,
    uniqueTransactionId: transactionId,
    startDate: startDateIso,
    endDate: endDateIso
)

// Ad impression / mediation revenue logging
AKSLogManager.shared.logImpression(
    adUnit: adUnitId, adNetwork: "admob", adFormat: "interstitial",
    revenue: revenueString, currency: "USD",
    mediationABTestName: nil, mediationABTestVariant: nil
)

// SDK build/version banner
AKSLogManager.shared.logAarVersion()

AppsKitSDKLogType:.info、.error、.verbose、.warning、.description_。description_ の末尾のアンダースコアは意図的なもので、タイプミスではありません。NSObject/CustomStringConvertible の description プロパティとの名前の衝突を避けるために付けられています。