Snowplow Android and iOS trackers version 5.0.0-beta.1 released

We are pleased to announce the release of our iOS and Android mobile trackers version 5.0.0-beta.1. This is the new pre-release of the upcoming version 5 of the mobile trackers, written in Swift and Kotlin respectively. This beta release brings new features as well as refactoring the tracker internals.

The headline feature for both trackers is the ability to provide custom tracker plugins to intercept tracked events. Plugins provide callbacks that can enrich events with additional entities, or inspect tracked events.

See this snippet for a glimpse of a tracker plugin in Kotlin:

// 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
)

The Android tracker is now fully written in Kotlin.

For the iOS tracker, we’ve simplified the tracker configuration, using Swift DSL. Configuration objects can be provided directly as part of a closure for createTracker():

Snowplow.createTracker(namespace: "appTracker", endpoint: COLLECTOR_URL) {
  TrackerConfiguration()
      .base64Encoding(false)
      .sessionContext(true)

  SessionConfiguration(
      foregroundTimeout: Measurement(value: 30, unit: .minutes),
      backgroundTimeout: Measurement(value: 30, unit: .minutes)
  )
}

We are continuing to work on these trackers and would love any feedback.

CHANGELOG

iOS

Enhancements

  • Add ability to provide custom tracker plugins to inspect and enrich tracked events (#750)
  • Use Swift DSL for building configurations and add builder functions for configurations and events (#755)

Under the hood

  • Remove requirement for all configurations to be serializable (#753)
  • Refactor event interface and rename contexts to entities (#757)
  • Refactor APIs to replace usage of NSObject in dictionaries with the Any type (#748)
  • Update year in copyright headers and remove authors from headers in source files (#759)

Android

Enhancements

  • Add ability to provide custom tracker plugins to inspect and enrich tracked events (#574)

Under the hood

  • Update copyrights to 2023 (#579)
  • Refactor event interface and rename contexts to entities (#573)
  • Migrate internal classes to Kotlin (#564)

Snowplow Android Tracker version 5.0.0-beta.1 is available on Maven Central.
The project’s source code can be found here.

Snowplow iOS Tracker version 5.0.0-beta.1 is available on Cocoapods.
The project’s source code can be found here.

5 Likes