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.

refererUrl is the full URL that was loaded in the user’s browser when the install started. This typically is your landing page URL. It can include all query parameters added by an ad network, such as UTM tags and click IDs.

API

Example

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

Last updated

Was this helpful?