CookyAnalytics 0.1.1

CookyAnalytics 0.1.1

Hao Nguyen 维护。



  • haonn

DIAnalyticsSDK

示例

要运行示例工程,首先克隆仓库,然后在 Example 目录下运行 pod install

要求

iOS 9.0+

安装

DIAnalyticsSDK 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile 即可

pod 'DIAnalyticsSDK', :git => "[email protected]:datainsider/analytics/datainsider-analytics-ios.git", :tag => 'x.x.x'
# replace x.x.x with newest version, ie: 0.1.2 

用法

在使用前配置 SDK

import DIAnalyticsSDK

Analytics.configure(apiKey: "API-KEY", trackingUrl: TRACKING_URL)
其他配置
var config = Configuration(apiKey: apiKey, trackingUrl: trackingUrl)

/// Events will be submit by batch every @submitInterval seconds. Default: 1min
config.submitInterval = 1 * 60

/// Timeout interval for submit request. Default 2mins
config.submitTimeoutInterval = 2 * 60

/// Max size in byte per log file. Default 1MB
config.maxSizeOfLogFile = 1 * 1024 * 1024

/// Max number of log file stored. Default 10
config.maxNumberOfLogFile = 10

/// if set false, log will be submit immediately. Default true
config.queueEnabled = true

/// If there are no interactions in @sessionExpireTime, new session will be generated. Default 10mins
config.sessionExpireTime = 10 * 60

/// if true only submit log when connected to a wifi network
config.submitLogOnWifiOnly = false

Analytics.configure(config: config)

记录事件

Analytics.logEvent("in_app_purchase", parameters: [
    "pid": "p001"
])

设置用户信息

Analytics.setUser("uid_1", info: [
    "name": "John"
])

为所有事件添加共享属性

//set value = nil to remove shared parameters
Analytics.addSharedParameters([
    "utm_source": "google",
])

作者

liemvu, [email protected]

许可

DIAnalyticsSDK 可在 Creative Common 许可下获得。有关更多信息,请参阅 LICENSE 文件。