イベントトラッキング #
ページビューをカウントしないトラッキングとして、イベントトラッキングを実行することができます。
イベントトラッキングは event
メソッドにより実行します。
ただし、イベントトラッキングを実行するには、予め通常のトラッキングを実行しておく必要があります。
- イベントトラッキングのパラメータはトラッキングのパラメータと同じです。ただし、 referrer は指定することはできません。
- イベントトラッキングは、PVをカウントしない以外はトラッキングと同等なため、閲覧学習・購買学習・残留カート情報の収集・レコメンドコンテンツの効果測定などの情報も指定することができます。
サンプルコード #
スコア値 score1
の値として "A"
を送信するイベントトラッキングのサンプルです。
let customValues = [
"score1": "A"
]
do {
try Rtoaster.event(.Builder()
.location(Location("testLocation"))
.values(TrackingValues.Builder()
.customValues(customValues)
.build()
)
.build()
).onFailure { [weak self] error in
print("Communication error: \(error.toMap())")
}
} catch {
print("Parameter error: \(error.toMap())")
}
val customValues = mapOf(
"score1" to "A"
)
try {
Rtoaster.event(TrackingParameter {
location(Location("testLocation"))
values(TrackingValues {
customValues(customValues)
})
}).onFailure {
Log.d("Rtoaster", "Communication error", it)
}
} catch (e: Exception) {
Log.d("Rtoaster", "Parameter error", e)
}