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.

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

MethodStandard event nameRevenue
trackPageView()PageView
trackViewContent()ViewContent
trackSearch()Search
trackAddToCart()AddToCart
trackAddToWishlist()AddToWishlist
trackInitiateCheckout()InitiateCheckout
trackAddPaymentInfo()AddPaymentInfo
trackPurchase(value:currency:)Purchaserequired
trackLead()Lead
trackCompleteRegistration()CompleteRegistration
trackContact()Contact
trackSchedule()Schedule
trackFindLocation()FindLocation
trackCustomizeProduct()CustomizeProduct
trackSubmitApplication()SubmitApplication
trackApplicationApproval()ApplicationApproval
trackDownload()Download
trackSubmitForm()SubmitForm
trackStartTrial(value:currency:)StartTrialrequired
trackSubscribe(value:currency:)Subscriberequired
trackDonate(value:currency:)Donaterequired
trackSpentCredits(value:)SpentCreditsvalue 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)
DimensionDescription
productIdThe product / SKU identifier
offeringIdThe offering the product belongs to
paywallIdThe paywall the event came from
experimentIdThe experiment in flight
variantIdThe variant the user saw
entitlementIdThe entitlement granted
placementWhere 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 hyphen

Currency 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()