Version 5.0.0-beta.1
Pre-release
Pre-release
mscwilson
released this
03 Feb 11:46
·
105 commits
to master
since this release
This is the second pre-release of the upcoming version 5 of the Android tracker written in Kotlin. This beta release brings new features as well as refactoring the tracker internals. All of the code is now in Kotlin.
The headline feature is the ability to provide custom tracker plugins to intercept tracked events. Plugins provide callbacks that can enrich events with additional entities and inspect tracked events. See this snippet for a glimpse of a tracker plugin:
// identifier needs to uniquely identify the plugin
val plugin = PluginConfiguration("myPlugin")
// entities closure can return context entities to enrich events
// the list of schemas to call the closure for is optional (it will be called for all events if null)
plugin.entities(listOf("iglu:...")) {
return [
SelfDescribingJson(schema: "iglu:xx", andData: ["yy": true])
]
}
// after track callback called on a background thread to inspect final tracked events
// one can also supply a list of schemas to call the closure only for specific events
plugin.afterTrack {
print("Tracked event with $event.entities.size entities")
}
// the plugin is supplied to the tracker as a configuration
val tracker = Snowplow.createTracker(
context = context,
namespace = "ns",
network = networkConfig,
plugin
)
Enhancements
- Add ability to provide custom tracker plugins to inspect and enrich tracked events (#574)
Under the hood