linkAttribution

User attribution helps you understand where a user came from before installing your app.

In OnsideKit, attribution links the app install to a prior session in a web browser. The SDK can then return a refererUrl that describes the source page.

Requirements

Attribution depends on early SDK initialization.

Call Onside.initialize() as early as possible at app launch. Do this before any other OnsideKit API calls.

If you skip or delay initialization, attribution may fail or return incomplete metadata. See Installation Guide.

Getting attribution metadata

Call Onside.getAttributionMetadata(completion:).

The completion returns either:

  • OnsideAttributionMetadata on success.

  • OnsideAttributionMetadataError on failure.

OnsideAttributionMetadata contains an optional refererUrl.

  • refererUrl != nil means the SDK attributed the install to a browser session.

  • refererUrl == nil means the install was organic, or attribution was not possible.

API

Onside.getAttributionMetadata(
    completion: @escaping @MainActor (Result<OnsideAttributionMetadata, OnsideAttributionMetadataError>) -> Void
)

Example

This example initializes the SDK at launch, then fetches attribution metadata.

Last updated

Was this helpful?