Snowplow Android Tracker 1.4.0 released


We are pleased to announce a new release of the Snowplow Android Tracker. Version 1.4.0 introduces support for GDPR contexts and tracker diagnostics, useful for troubleshooting cases of unexpected tracker behaviour.
Also included in this release is a fix to stop the IAB enrichment from considering Android tracker events as spider-generated events.
Read on below for:
- Tracking GDPR basis for processing with the GDPR context
- Diagnostic feature for internal error tracking
- Fix for IAB enrichment identification
- Make POST path of Emitter configurable
- Updates and bug fixes
- Documentation
- Getting help
1. Tracking GDPR basis for processing with the GDPR context
This release introduces the gdprContext
and the enableGdprContext
methods, which append a GDPR context to all events once enabled (#312). This allows users to easily record the basis for data collection and relevant documentation, and enables a straightforward audit flow for all events.
It takes the following arguments:
Name | Description | Required? | Type |
---|---|---|---|
basisForProcessing | GDPR Basis for processing | Yes | Enum String |
documentId | ID of a GDPR basis document | No | String |
documentVersion | Version of the document | No | String |
documentDescription | Description of the document | No | String |
The required basisForProcessing accepts only the following literals: consent
, contract
, legal_obligation
, vital_interests
, public_task
, legitimate_interests
– in accordance with the five legal bases for processing
The GDPR context is enabled by calling the gdprContext
method of the tracker builder or by calling the enableGdprContext
method once the tracker has been initialised.
It is called as follows:
Tracker.instance().enableGdprContext(
Gdpr.Basis.CONSENT,
"someId",
"0.1.0",
"a demo document description"
);
2. Diagnostic feature for internal error tracking
The tracker is constantly tested with different platforms and versions but there are rare situations where an error can be reported. The tracker manages errors internally, avoiding crashes of the app and assuring that the events are not lost. Now, the tracker can also report errors to a Snowplow collector as diagnostic_error
events.
To activate this feature you only need to enable trackerDiagnostic
(#343):
TrackerBuilder trackerBuilder =
new TrackerBuilder(emitter, namespace, appId, appContext)
.trackerDiagnostic(true)
...
.build();
Tracker.init(trackerBuilder);
It will automatically report any internal tracker errors to the configured Snowplow collector. These will be fundamental for troubleshooting unexpected behaviour of the tracker. For Snowplow BDP customers, the sequence of tracker diagnostic events can be sent to the Snowplow support team for analysis in order to spot tracker issues or the source of unexpected behaviour.
“unstruct_event_com_snowplowanalytics_snowplow_diagnostic_error_1”: { “className”: “Tracker”, “message”: “pool-1-thread-2|Error tracker message” }
3. Fix for IAB enrichment identification
As reported here the IAB enrichment incorrectly treats events sent by the Android tracker as spider-generated. The Android Tracker uses the okHttp library. The default User Agent of that library is in the IAB blacklist, which caused the Android tracker to be seen as spider-generator.
The new Android tracker sets a different default User Agent that is not filtered out by the IAB enrichment (#359). It’s always possible to customize the User Agent used by the Android tracker by setting the User Agent of the tracker’s Subject: setUserAgent
.
Subject subject =
new Subject.SubjectBuilder()
...
.setUserAgent("my-custom-user-agent")
...
.build();
TrackerBuilder trackerBuilder =
new TrackerBuilder(emitter, namespace, appId, appContext)
...
.subject(subject)
...
.build();
Tracker.init(trackerBuilder);
4. Make POST path of Emitter configurable
This is a feature already introduced in the Obj-C tracker as of version 1.1.0, and is now available in the Android tracker (#319). With the new version there is a new customPostPath
parameter that makes the Emitter configurable. It allows specifying a custom path for POST requests, this is useful when the user wants to use a proxy for receiving the events.
Emitter emitter =
new Emitter.EmitterBuilder(uri, context)
...
.method(HttpMethod.POST)
.customPostPath("com.acme.company/tpx")
...
.build();
TrackerBuilder trackerBuilder =
new TrackerBuilder(emitter, namespace, appId, appContext)
...
.build();
Tracker.init(trackerBuilder);
5. Updates and bug fixes
- Bump target Android API to 29 (#357)
We updated the library and the demo app to be fully compatible with Android 10 (API 29). It doesn’t introduce any incompatibility with old versions and the minimum Android OS version supported is still Android 4.0 (API 14).
- Cannot unset user id from subject (#353)
This bug causes issues when a parameter that is not required is set to null. In particular it has been reported that the uid
parameter couldn’t be cleared from the Subject once it was set the first time. Now, setting it to null
clears the parameter.
- The method
Util.getEventId
is deprecated
It is a utility function in the Util
class able to generate random UUID. It has been renamed to getUUIDString
. The method getEventId
will be removed in the future v2.0 release.
6. Documentation
As always, information about how to use the tracker can be found in the Android Tracker documentation.
You can find the full release notes on GitHub as Snowplow Android Tracker v1.4.0 release.
7. Getting help
For help on integrating the tracker please have a look at the setup guide. If you have any questions or run into any problems, please visit our Discourse forum. Please raise any bugs in the Android Tracker’s issues on GitHub.