Command Dispatcher that routes Tealium Prism tracking events to the Firebase Analytics iOS SDK — events, user properties, consent settings, and more.
Important: Firebase Analytics only supports a single shared instance. Only one
firebaseDispatchercan be active at a time in your app.
| Dependency | Version |
|---|---|
| iOS | 15.0+ |
| macOS | 10.15+ |
| tvOS | 15.0+ |
| Swift | 6.0+ |
| Tealium Prism Core | >= 0.5.0 |
| Firebase iOS SDK | 12.0.0+ |
- In Xcode, select File > Add Package Dependencies.
- Enter the repository URL:
https://github.com/Tealium/tealium-prism-ios-firebase-dispatcher - Configure the version rules. Up to Next Major is recommended.
- Select
TealiumPrismFirebaseand add it to your app target.
Or add it manually to Package.swift:
.package(url: "https://github.com/Tealium/tealium-prism-ios-firebase-dispatcher.git", from: "0.1.0")Add the following line to your Podfile:
pod 'TealiumPrismFirebase'Place GoogleService-Info.plist in the app target root. The Firebase Dispatcher calls FirebaseApp.configure() automatically on first use. If you need custom initialization order (e.g. for Crashlytics), call FirebaseApp.configure() manually — add import FirebaseCore to your app entry point and call it before Tealium.create(config:). The dispatcher will detect the existing FirebaseApp and skip its own initialization.
To run the example project, clone the repo and open Example/Example.xcodeproj in Xcode. Add a real GoogleService-Info.plist and run the Example scheme.
The example app demonstrates:
- Automatic and manual Firebase initialization approaches
- Every Firebase command with real-world use cases
- Purchase events with items and custom parameters
- User ID and user property management
- Consent settings (grant/deny all)
- On-device conversion measurement with plaintext and hashed credentials
Register the Firebase Dispatcher when initializing Tealium Prism:
import TealiumPrismCore
import TealiumPrismFirebase
let config = TealiumConfig(
account: "my_account",
profile: "my_profile",
environment: "prod",
modules: [
Modules.collect(),
Modules.firebaseDispatcher(),
],
settingsFile: "TealiumSettings"
)
let tealium = Tealium.create(config: config)The Firebase Dispatcher can be configured via a local JSON settings file, remote settings, or programmatically.
| Setting | JSON Key | Type |
|---|---|---|
| Session timeout | session_timeout_seconds |
Double (seconds) |
| Analytics collection enabled | analytics_collection_enabled |
Bool |
| Log level | log_level |
String — "min", "error", "warning", "notice", "info", "debug", "max" |
If a setting is omitted, Firebase uses its own default value.
Note: JSON
log_levelstrings map 1:1 ontoFirebaseLoggerLevelcases (e.g."min"→.min,"debug"→.debug). The reverse is not one-to-one: Firebase defines.minand.errorwith the same underlying value, as it does.maxand.debug, sosetLogLevel(.min)persists as"error"andsetLogLevel(.max)as"debug". The effect on Firebase is identical.
Configure the module in your TealiumSettings.json file:
{
"modules": {
"FirebaseDispatcher": {
"module_type": "FirebaseDispatcher",
"configuration": {
"session_timeout_seconds": 1800,
"analytics_collection_enabled": true,
"log_level": "debug"
}
}
}
}Use FirebaseSettingsBuilder to enforce settings that cannot be overridden remotely:
Modules.firebaseDispatcher(forcingSettings: { builder in
builder
.setSessionTimeout(30.minutes)
.setAnalyticsEnabled(true)
.setLogLevel(.min)
})Note: Programmatic settings always take precedence over local and remote settings. Only use them for values that must never be changed remotely.
FirebaseSettingsBuilder extends DispatcherSettingsBuilder<FirebaseMappings> and provides these methods:
| Method | Description |
|---|---|
setSessionTimeout(_ sessionTimeout: TimeFrame) |
Session timeout (e.g. 30.minutes) |
setAnalyticsEnabled(_ enabled: Bool) |
Enable or disable analytics collection |
setLogLevel(_ level: FirebaseLoggerLevel) |
Firebase internal log verbosity |
setMappings(_ mappingsSetup: @escaping (FirebaseMappings) -> Void) |
Configure data mappings |
setEnabled(_ enabled: Bool) |
Enable or disable the module |
setOrder(_ order: Int) |
Dispatcher execution order |
setRules(_ rules: Rule<String>) |
Conditional dispatch rules by load rule ID |
| Command | Firebase API | Guide |
|---|---|---|
logevent |
Analytics.logEvent(_:parameters:) |
LogEvent |
setuserid |
Analytics.setUserID(_:) |
SetUserID |
setuserproperty |
Analytics.setUserProperty(_:forName:) |
SetUserProperty |
resetdata |
Analytics.resetAnalyticsData() |
ResetData |
setdefaultparameters |
Analytics.setDefaultEventParameters(_:) |
SetDefaultParameters |
setconsent |
Analytics.setConsent(_:) |
SetConsent |
setsessiontimeout |
Analytics.setSessionTimeoutInterval(_:) |
SetSessionTimeout |
setanalyticscollectionenabled |
Analytics.setAnalyticsCollectionEnabled(_:) |
SetAnalyticsCollectionEnabled |
initiateconversionmeasurement |
Analytics.initiateOnDeviceConversionMeasurement(...) |
InitiateConversionMeasurement |
The Firebase Dispatcher routes dispatch data to Firebase using the Tealium Prism Mappings system, and each
command has its own guide covering the JSON and programmatic mapping configuration, payload shapes, and
error behaviour. Start with Mappings for the concepts shared by all commands —
command_name binding, destinations, and the JSON mapping schema.
The same guides are published alongside the generated API reference at tealium.github.io/tealium-prism-ios-firebase-dispatcher.
See the Example app's
TealiumSettings.jsonfor a complete configuration covering all commands.
Generated documentation for the public API is published at tealium.github.io/tealium-prism-ios-firebase-dispatcher.
Build it locally with:
bundle install
./scripts/docs.shOutput lands in _site.
TealiumPrismFirebase is available under a commercial license. See the LICENSE file for more info.