Tracking Events
Attribute in-app behaviour and revenue back to the link that drove the install — which events to send, how to name them, and where they surface.
Use trackEvent to attribute in-app behavior (and revenue) to the link and campaign that drove the install.
LinkTrail.shared?.trackEvent(name: "purchase", value: 49.99, currency: "USD")LinkTrail.shared?.trackEvent(name = "purchase", value = 49.99, currency = "USD")await LinkTrail.trackEvent('purchase', { value: 49.99, currency: 'USD' });await LinkTrail.trackEvent(name: 'purchase', value: 49.99, currency: 'USD');Events appear in the dashboard's Analytics section and feed attribution and CVR metrics. value and currency are optional — omit them for non-revenue events.
Consent
Events go through the same consent gate as the install. With the default requireConsent: true, until your app records a decision — and after setConsent(false) whatever the setting — trackEvent drops the event: it is not sent and not queued. A denial also clears the offline queue and drops any event in flight or being retried. Details in Consent & privacy.
Retries and the offline queue
Each event is retried with backoff (3 attempts by default, see retryPolicy). If it still fails, what happens next depends on why:
| Failure | What the SDK does |
|---|---|
| Transport error (offline, timeout), 408, 429 or 5xx | Reported to onError, then kept in the offline queue on the device and sent again later. Idempotency keys stop a resend from being counted twice. |
| Any other status (400, 401, 403, 404, 409, 422, …) | Reported to onError and dropped — it is not retried on a later launch. The log shows [LinkTrail] [WARNING] Event '<name>' rejected (<status>) — not retried. |
The queue is flushed at configure, when consent is granted and after each successful send (an install or an event), one flush at a time. It sends nothing while consent is denied, or not yet given under requireConsent, and stops if consent is withdrawn mid-flush. A queued entry that gets a non-retryable status on a flush is dropped the same way.