iOS Engagement SDK (BillDogEng)
iOS Engagement Suite
The BillDogEng product targets the core engagement features of the BillDog platform: Analytics, Outbound Messaging, In-App Surveys, and Feature Flags. It is built as a static framework, omitting paywalls, StoreKit dependency, and external assets like Lottie.
Included Framework Sub-Modules
Importing BillDogEng pulls in all engagement-centric libraries:
Analytics
Behavior capturing, deep links, auto-tracking, and session replays.
Surveys
Native SwiftUI / UIKit survey presentation engine.
Messaging
In-app trigger messaging and local/push notification triggers.
1. Installation
Add the Swift Package to your Package.swift dependencies, selecting the BillDogEng product target:
dependencies: [
.package(url: "https://github.com/billdogai/billdog-ios-spm.git", from: "1.2.0-beta.1")
],
targets: [
.target(
name: "YourAppTarget",
dependencies: [
.product(name: "BillDogEng", package: "billdog-ios-spm")
]
)
]2. Initialization
Configure the singleton client in your AppDelegate or Swift structure at app startup:
import BillDogEng
// BillDogEng ships NO 'BillDog' facade (it lives in the paywall module),
// so you configure each manager directly from one shared BillDogConfig.
let billDogConfig = BillDogConfig(
apiKey: "YOUR_API_KEY_HERE", // Starts with bd_public_test_ or bd_public_live_
enableLogging: true,
environment: .production
)
// Analytics & A/B managers are instances you retain and reuse
let analytics = BillDogAnalyticsManager()
let abTest = BillDogABTestManager()
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
// Configure each engagement manager once, globally
analytics.configure(config: billDogConfig)
abTest.configure(config: billDogConfig)
BillDogNotificationsManager.shared.configure(config: billDogConfig)
BillDogInAppMessagesManager.shared.configure(config: billDogConfig)
return true
}
}3. Analytics & Identity
Track custom actions, log in players, and map traits:
// Associate the current user (persists the distinct id)
analytics.identify(userId: "user_9981")
// Identify with traits attached as event properties
analytics.identify(
userId: "user_9981",
properties: ["plan": "premium_tier_1", "cohort": "june_2026"]
)
// Track custom behaviors — the manager takes an event object, not a string
analytics.track(
event: BillDogAnalyticsEvent(
name: "tutorial_step_completed",
properties: ["step_index": 3, "skipped": false]
)
)4. In-App Surveys
Present in-app surveys dynamically using the SwiftUI or UIKit survey presenter:
import BillDogEng
// Engagement-only ships no BillDog.getSurveyPresenter() facade — construct the
// presenter yourself from an APIClient configured with your BillDogConfig.
let apiClient = APIClient()
apiClient.configure(
apiKey: billDogConfig.apiKey,
apiBase: billDogConfig.apiBaseUrl,
projectId: billDogConfig.projectId
)
let surveyManager = BillDogSurveyManager(apiClient: apiClient)
let presenter = BillDogSurveyPresenter(surveyManager: surveyManager)
presenter.isEnabled = true
// Present survey manually with lifecycle callbacks
presenter.present(
surveyId: "post_purchase_feedback",
from: self, // UIViewController context
handler: SurveyPresentationHandler(
onPresent: { id in print("Survey displayed: \(id)") },
onDismiss: { id in print("Survey dismissed: \(id)") },
onComplete: { id, result in print("Respondent ID: \(result.respondent_id)") }
),
customerId: "user_9981",
customVariables: ["checkout_total": "49.99"] // values are [String: String]
)5. Remote Feature Flags
Feature flags are evaluated remotely by the server. Check status and variants:
// Fetch the latest experiment + flag assignments first
await abTest.fetchExperiments()
// Check boolean status (there is no isFeatureEnabled — use getFeatureFlag)
if abTest.getFeatureFlag(key: "new_feed_algorithm") {
loadExperimentalFeed()
}
// Get the assigned multivariate variant and its remote payload
if let variant = abTest.getFeatureFlagVariant(key: "new_feed_algorithm") {
print("Active Variant: \(variant)")
if let payload = abTest.getFeatureFlagPayload(key: "new_feed_algorithm") {
applyConfig(payload)
}
}6. In-App Message Triggers
Fire a named trigger to evaluate the in-app messages targeted to it and display any that match the current user:
// Evaluate and display any in-app message armed for this trigger
BillDogInAppMessagesManager.shared.checkForMessages(
trigger: "checkout_success_banner",
properties: ["source": "post_purchase"]
)Package conflicts
BillDogFull (the full paywall SDK) and BillDogEng (the engagement library) in the same project target.Was this page helpful?
Or rate this page: