Skip to content

[AISP-1030] Document beforeTrack plugin callback in mobile tracker docs #1802

Description

@snowplow-claude-review

Implementation task — AISP-1030


What

Add a new "Intercepting events before they are tracked" section to the mobile tracker plugin documentation, covering the beforeTrack callback now available in both the iOS and Android trackers.

Why

beforeTrack is a new plugin callback that lets host apps overwrite or add event payload fields before events are sent to the collector — for example, stripping sensitive fields when a user has only partially consented. Without documentation the feature is not discoverable, and three non-obvious constraints (thread-safety, overwrite/add-only semantics, raw key names) need to be surfaced prominently to prevent misuse.

Approach

Insert a new subsection immediately before the existing "Inspecting events after they are tracked" (afterTrack) section in the mobile plugin docs, mirroring its tab-based code-example structure (iOS Swift / Android Kotlin / Android Java). The primary code example should illustrate consent-based field stripping. Three constraints must be called out explicitly as noted in Changes below.

Depends on

  • Both the snowplow-ios-tracker and snowplow-android-tracker beforeTrack PRs must be merged and released before this PR is merged, so that code examples reference the released API rather than unreleased snapshots.

Changes

  • docs/sources/mobile-trackers/plugins/index.mdMODIFY — Add a new ### Intercepting events before they are tracked section immediately before the existing ### Inspecting events after they are tracked section (currently around line 162). The section must include:
    1. A consent-based field-stripping code example in iOS (Swift) and Android (Kotlin + Java) tabs, using the same tab structure as the afterTrack section.
    2. An explicit callout that on iOS the closure runs on the tracker's InternalQueue: a blocking call inside the closure (e.g. synchronous I/O or a lock wait) will stall event tracking.
    3. A callout that v1 supports overwrite and add only — returning a key with a new value overwrites it in the payload; key removal is not supported in this release.
    4. A note that the payload is keyed by raw tracker field names (e.g. url, se_ca) rather than the final collector field names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    implementIssue queued for AI implementation by the agent

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions