For the complete documentation index, see llms.txt. This page is also available as Markdown.

Testing your integration

Before shipping, confirm two things: the SDK is running, and events you fire actually reach the Amply dashboard. This page shows the helpers you use to verify each step locally, and the log controls that surface what the SDK is doing internally.

A PM should read this as: "the SDK has built-in diagnostic helpers — the developer can print the last events, inspect the current state the SDK knows about, and turn on verbose logging during integration."

Use this when you're integrating the SDK for the first time, debugging a campaign that won't fire, or tracking down why an event doesn't show up in the dashboard.

Don't use this when you're investigating a production-only issue — the debug helpers are meant for local or staging builds, and some signals (like session boundaries on iOS) only reproduce on a real device or simulator. Leave debug logging off in release builds.

Turn on verbose logging

During integration, set the log level to debug. Production apps should leave it at none (or error).

amply.setLogLevel(level: "debug")
// or
amply.setLogLevel(level: .debug)

Log levels, least-to-most verbose: none, error, warn, info, debug.

Inspect recent events

The SDK keeps a local list of the events it has seen — both the custom ones you tracked and its own system events. Useful for sanity-checking that your track calls actually landed before they've been flushed to the backend.

Task {
    let events = try await amply.getRecentEvents(limit: 30)
    for event in events {
        print("\(event.timestamp) \(event.name) \(event.type) \(event.properties)")
    }
}

limit defaults to 30. Events are returned newest-first.

Inspect what the SDK knows about the user

getDataSetSnapshot returns the current state of a named dataset — device info, user attributes, current session, recent events, or triggered event counts. Use it to verify that setUserId, setCustomProperties, and your track calls have the effect you expect.

Available datasets:

Dataset
What's in it

@device

Device and app fields (model, OS version, advertising identifier, app build, locale)

@user

The user ID and related user-level data

@custom

The custom properties you set via setCustomProperty / setCustomProperties

@session

Current session (start time, session index, source)

@triggeredEvent

Counts for a specific triggered event name

@events

Counts / aggregates for a set of events

Verifying events reach the dashboard

Once the SDK is running with debug logging on:

  1. Open the Amply dashboard for your application.

  2. Fire a test event from the app (a screen view, a button tap).

  3. Watch the device console for [Amply] log lines confirming the event was queued and flushed.

  4. Open the dashboard's event view and look for the event name.

If the event appears in getRecentEvents but not in the dashboard after a minute, check:

  • The app has network access.

  • The app was initialized with the correct appId, apiKeyPublic, and apiKeySecret for your project.

  • The SDK logs don't show authentication or network errors (turn log level up to debug).

If the event doesn't appear in getRecentEvents at all, the call to track didn't reach the SDK — check for typos, make sure the SDK is initialized, and that you're not calling from a build variant with a different configuration.

Quick diagnostics checklist

  • SdkInitialized fires (see Handling callbacks)

  • getDataSetSnapshot({ kind: '@device' }) returns a non-empty map

  • getDataSetSnapshot({ kind: '@user' }) reflects the userId you set

  • getDataSetSnapshot({ kind: '@custom' }) reflects the custom properties you set

  • getRecentEvents(30) shows your last few tracked events

  • The dashboard shows the same events within ~1 minute

Last updated