How to use the Linkrunner SDK in your Flutter app
secretKey
: A unique secret key used for request signing and authenticationkeyId
: A unique identifier for the key pair used in the signing processgetAttributionData
method.
signup
method once after the user has completed your app’s onboarding process:
It is strongly recommended to use the integrated platform’s identify function to set a persistent user_id once it becomes available (typically after signup or login).
getAttributionData
function:
getAttributionData
function returns an AttributionData
object with the following structure:
setUserData
each time the app opens and the user is logged in:
setAdditionalData
method to set CleverTap ID:
LinkRunner.setAdditionalData
clevertap_id
: String (optional) - CleverTap user identifieramount
parameter as a number in your custom event data. This allows the ad networks to optimize campaigns based on the revenue value of conversions:
amount
parameter is passed as a number (double
or int), not as a string.LRCapturePayment
amount
: double (required) - The payment amountuserId
: String (required) - Identifier for the user making the paymentpaymentId
: String (optional) - Unique identifier for the paymenttype
: PaymentType (optional) - Type of payment. Available options:
PaymentType.FIRST_PAYMENT
- First payment made by the userPaymentType.SECOND_PAYMENT
- Second payment made by the userPaymentType.WALLET_TOPUP
- Adding funds to a walletPaymentType.FUNDS_WITHDRAWAL
- Withdrawing fundsPaymentType.SUBSCRIPTION_CREATED
- New subscription createdPaymentType.SUBSCRIPTION_RENEWED
- Subscription renewalPaymentType.ONE_TIME
- One-time paymentPaymentType.RECURRING
- Recurring paymentPaymentType.DEFAULT_PAYMENT
- Default type (used if not specified)status
: PaymentStatus (optional) - Status of the payment. Available options:
PaymentStatus.PAYMENT_INITIATED
- Payment has been initiatedPaymentStatus.PAYMENT_COMPLETED
- Payment completed successfully (default if not specified)PaymentStatus.PAYMENT_FAILED
- Payment attempt failedPaymentStatus.PAYMENT_CANCELLED
- Payment was cancelledFunction | Where to Place | When to Call |
---|---|---|
LinkRunner().init | App initialization | Once when app starts |
LinkRunner().getAttributionData | Attribution data handling flow | Whenever the attribution data is needed |
LinkRunner().setAdditionalData | Integration code | When third-party integration IDs are available |
LinkRunner().signup | Onboarding flow | Once after user completes onboarding |
LinkRunner().setUserData | Authentication logic | Every time app opens with logged-in user |
LinkRunner().trackEvent | Throughout app | When specific user actions occur |
LinkRunner().capturePayment | Payment processing | When user makes a payment |
LinkRunner().removePayment | Refund flow | When payment needs to be removed |