iOS SDK
iOS SDK - Tracking Events
Track events with the Pricist iOS SDK.
Every track… call snapshots the current identity and dimensions, enqueues one event to a disk-backed queue, and flushes it to Pricist. Events survive app restarts and bad networks.
Automatic events
Two lifecycle events fire automatically — you don't need to call them:
Install— once, on the first launch after install.ActivateApp— on every cold start.
Standard events (recommended)
Typed methods cover the full Meta/TikTok standard-event taxonomy. Because the names match verbatim, attribution can be layered on server-side without changing your call sites. Every typed method accepts optional parameters and dimensions arguments.
Subscription lifecycle (revenue events)
trackStartTrial, trackSubscribe, trackPurchase, and trackDonate require value and currency:
// Free trial — pass 0 for value
Pricist.shared.trackStartTrial(value: 0, currency: "USD")
// Paid subscription started
Pricist.shared.trackSubscribe(value: 9.99, currency: "USD")
// One-off purchase
Pricist.shared.trackPurchase(value: 29.99, currency: "USD")
// Donation
Pricist.shared.trackDonate(value: 50.00, currency: "USD")
// In-app virtual currency — value only, no currency
Pricist.shared.trackSpentCredits(value: 500)Engagement, commerce & lifecycle
Pricist.shared.trackViewContent()
Pricist.shared.trackAddToCart()
Pricist.shared.trackInitiateCheckout()
Pricist.shared.trackCompleteRegistration()
Pricist.shared.trackCompleteTutorial()
Pricist.shared.trackLead()All standard events
| Method | Standard event name | Revenue |
|---|---|---|
trackPageView() | PageView | |
trackViewContent() | ViewContent | |
trackSearch() | Search | |
trackAddToCart() | AddToCart | |
trackAddToWishlist() | AddToWishlist | |
trackInitiateCheckout() | InitiateCheckout | |
trackAddPaymentInfo() | AddPaymentInfo | |
trackPurchase(value:currency:) | Purchase | required |
trackLead() | Lead | |
trackCompleteRegistration() | CompleteRegistration | |
trackContact() | Contact | |
trackSchedule() | Schedule | |
trackFindLocation() | FindLocation | |
trackCustomizeProduct() | CustomizeProduct | |
trackSubmitApplication() | SubmitApplication | |
trackApplicationApproval() | ApplicationApproval | |
trackDownload() | Download | |
trackSubmitForm() | SubmitForm | |
trackStartTrial(value:currency:) | StartTrial | required |
trackSubscribe(value:currency:) | Subscribe | required |
trackDonate(value:currency:) | Donate | required |
trackSpentCredits(value:) | SpentCredits | value only |
trackAchieveLevel() | AchieveLevel | |
trackUnlockAchievement() | UnlockAchievement | |
trackRate() | Rate | |
trackCompleteTutorial() | CompleteTutorial | |
trackActivateApp() | ActivateApp | |
trackInAppAdClick() | InAppAdClick | |
trackInAppAdImpression() | InAppAdImpression |
Subscription dimensions
Attach first-class dimensions so the dashboard can group and build funnels on them. They are stored as dedicated columns, not buried in properties:
let dims = PricistEventDimensions(
productId: "com.app.premium.annual",
offeringId: "default",
paywallId: "onboarding_v2",
experimentId: "exp_ltv_max",
variantId: "variant_a",
entitlementId: "premium",
placement: "onboarding"
)
Pricist.shared.trackPurchase(value: 29.99, currency: "USD", dimensions: dims)| Dimension | Description |
|---|---|
productId | The product / SKU identifier |
offeringId | The offering the product belongs to |
paywallId | The paywall the event came from |
experimentId | The experiment in flight |
variantId | The variant the user saw |
entitlementId | The entitlement granted |
placement | Where in the app the event occurred |
Custom events
Track anything specific to your app:
// Simple
Pricist.shared.trackEvent("onboarding_complete")With properties
Use the PricistEventParameters bag (the properties bag), or a dictionary literal:
// Mutating struct
var params = PricistEventParameters()
params.set("step", value: 3)
params.set("variant", value: "B")
Pricist.shared.trackEvent("paywall_viewed", parameters: params)
// Dictionary literal
Pricist.shared.trackEvent("paywall_viewed", parameters: ["step": 3, "variant": "B"])With revenue
For revenue on a custom event, pass a PricistRevenue:
Pricist.shared.trackEvent("tip_sent", revenue: .usd(4.99))
// Other currencies
let eur = PricistRevenue.eur(19.99)
let gbp = PricistRevenue.gbp(14.99)
let jpy = PricistRevenue(amount: 2000.0, currency: "JPY")
// Decimal for precision
let precise = PricistRevenue(amount: Decimal(string: "99.99")!, currency: "USD")With revenue, properties & dimensions
Pricist.shared.trackEvent(
"tip_sent",
revenue: .usd(4.99),
parameters: ["recipient": "user_456"],
dimensions: PricistEventDimensions(placement: "creator_profile")
)Validation
Event names must be non-empty, ≤100 characters, and match ^[a-zA-Z][a-zA-Z0-9_]*$ (start with a letter; letters, numbers, and underscores only). Invalid names are logged and dropped.
Pricist.shared.trackEvent("level_2_complete") // OK
Pricist.shared.trackEvent("buttonClick") // OK
Pricist.shared.trackEvent("2nd_level") // dropped — starts with a number
Pricist.shared.trackEvent("my-event") // dropped — contains a hyphenCurrency must be a 3-letter ISO 4217 code; it is auto-uppercased.
Flushing
The SDK auto-flushes on the flushInterval and on backgrounding. Force a send anytime:
Pricist.shared.flush()