kenzi-capacitor-marketing-analytics
v1.0.1
Published
Unified Capacitor marketing analytics and attribution API for Firebase Analytics and Meta App Events
Maintainers
Readme
kenzi-capacitor-marketing-analytics
Unified marketing analytics and attribution for Capacitor and Ionic apps.
Developed by Kenzi.ai.
kenzi-capacitor-marketing-analytics exposes one TypeScript API and routes events to the supported native provider SDKs: Firebase Analytics and Meta/Facebook App Events.
Compatibility
- Capacitor 7+
- Ionic Angular
- Ionic React
- Ionic Vue
- Android
- iOS
- Native Capacitor plugin. This is not a Cordova plugin.
Install
Published package:
npm install kenzi-capacitor-marketing-analytics
npx cap syncLocal package inside this repo:
npm install ./packages/kenzi-capacitor-marketing-analytics
npx cap syncDeveloper setup checklist
Installing this package and running npx cap sync wires the Capacitor plugin into Android and iOS and adds the native SDK dependencies declared by the plugin:
- Firebase Analytics SDK
- Meta/Facebook App Events SDK
The plugin does not create provider accounts, app credentials, Firebase config files, Meta app settings, key hashes, bundle IDs, or privacy disclosures. Those must be configured per app.
1. Install and sync
npm install kenzi-capacitor-marketing-analytics
npx cap syncFor a local package during development:
npm install ./packages/kenzi-capacitor-marketing-analytics
npx cap sync2. Firebase Android
Add the Firebase Android config file:
android/app/google-services.jsonThe Firebase Android app package name must match your Android application ID, for example:
com.example.appThe host Android app must apply the Google Services Gradle plugin. Standard Capacitor Android projects usually already include this pattern in android/app/build.gradle.
If you manually log screen views through this plugin, disable Firebase automatic screen reporting to avoid duplicate or generic screen_view events:
android/app/src/main/AndroidManifest.xml
<application>
<meta-data
android:name="google_analytics_automatic_screen_reporting_enabled"
android:value="false" />
</application>3. Firebase iOS
Add the Firebase iOS config file to the iOS app target:
ios/App/App/GoogleService-Info.plistThe Firebase iOS app bundle ID must match your iOS bundle ID, for example:
com.example.appIf you manually log screen views through this plugin, disable Firebase automatic screen reporting to avoid duplicate or generic screen_view events:
ios/App/App/Info.plist
<key>FirebaseAutomaticScreenReportingEnabled</key>
<false/>4. Meta Android
Create or configure the Android app inside Meta Developer Console.
Required Android values:
- Meta App ID
- Meta Client Token
- Android package name, for example
com.example.app - Debug/release key hashes for the Android signing keys used to build the app
Do not use the Meta App Secret in the mobile app.
You can configure Meta natively through Android resources/manifest metadata, or pass runtime overrides from JavaScript:
android/app/src/main/res/values/strings.xml
<resources>
<string name="facebook_app_id">YOUR_META_ANDROID_APP_ID</string>
<string name="facebook_client_token">YOUR_META_ANDROID_CLIENT_TOKEN</string>
</resources>android/app/src/main/AndroidManifest.xml
<application>
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<meta-data
android:name="com.facebook.sdk.ClientToken"
android:value="@string/facebook_client_token" />
<meta-data
android:name="com.facebook.sdk.AutoLogAppEventsEnabled"
android:value="true" />
<meta-data
android:name="com.facebook.sdk.AdvertiserIDCollectionEnabled"
android:value="true" />
</application>Runtime override alternative:
await KenziMarketingAnalytics.initialize({
meta: {
enabled: true,
appId: 'YOUR_META_ANDROID_APP_ID',
clientToken: 'YOUR_META_ANDROID_CLIENT_TOKEN',
autoLogAppEventsEnabled: true,
advertiserIDCollectionEnabled: true,
},
});5. Meta iOS
Create or configure the iOS app inside Meta Developer Console.
Required iOS values:
- Meta iOS App ID
- Meta iOS Client Token
- iOS bundle ID, for example
com.example.app - Facebook URL scheme:
fbYOUR_META_IOS_APP_ID - Privacy text and App Store privacy declarations when using advertiser ID collection or ads measurement
Do not reuse an Android-only Meta App ID for iOS unless Meta has explicitly configured that app for the iOS bundle too.
Do not use the Meta App Secret in the mobile app.
You can configure Meta natively through Info.plist, or pass runtime overrides from JavaScript:
ios/App/App/Info.plist
<key>FacebookAppID</key>
<string>YOUR_META_IOS_APP_ID</string>
<key>FacebookClientToken</key>
<string>YOUR_META_IOS_CLIENT_TOKEN</string>
<key>FacebookDisplayName</key>
<string>YOUR_APP_DISPLAY_NAME</string>
<key>FacebookAutoLogAppEventsEnabled</key>
<true/>
<key>FacebookAdvertiserIDCollectionEnabled</key>
<true/>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>fbYOUR_META_IOS_APP_ID</string>
</array>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-share-api</string>
</array>If your app uses Meta login, app links, or other broader Meta SDK features, add the required URL schemes and associated domains from Meta's platform setup instructions. App Events alone can use runtime overrides or the native keys above.
If advertiserIDCollectionEnabled is enabled or the app requests App Tracking Transparency permission, add a clear tracking usage description:
<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads and measure marketing campaign performance.</string>For App Store uploads, the app is also responsible for its own privacy declarations. Add an app-level PrivacyInfo.xcprivacy to the iOS app target when your app or configured SDK usage collects analytics, product interaction, device identifiers, or uses tracking.
The Meta SDK may include its own SDK privacy manifest, but that does not replace your app's App Store privacy questionnaire or your app-level manifest for data your app collects.
Suggested host-app privacy manifest for apps using marketing analytics and ads attribution:
ios/App/App/PrivacyInfo.xcprivacy
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array/>
<key>NSPrivacyCollectedDataTypes</key>
<array>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypeDeviceID</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<true/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<true/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
<string>NSPrivacyCollectedDataTypePurposeThirdPartyAdvertising</string>
</array>
</dict>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypeProductInteraction</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<true/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<true/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
<string>NSPrivacyCollectedDataTypePurposeThirdPartyAdvertising</string>
</array>
</dict>
</array>
<key>NSPrivacyTracking</key>
<true/>
</dict>
</plist>Review this manifest against the actual app behavior and App Store privacy answers. Do not manually add Facebook domains such as facebook.com, graph.facebook.com, or subdomains of facebook.com to NSPrivacyTrackingDomains; the Meta SDK handles its own privacy manifest and may throw a runtime exception if those domains are manually listed by the host app.
Runtime override alternative:
await KenziMarketingAnalytics.initialize({
meta: {
enabled: true,
appId: 'YOUR_META_IOS_APP_ID',
clientToken: 'YOUR_META_IOS_CLIENT_TOKEN',
autoLogAppEventsEnabled: true,
advertiserIDCollectionEnabled: true,
},
});6. Initialize in app startup
Initialize once, usually from the app root component or startup service:
import { Capacitor } from '@capacitor/core';
import { KenziMarketingAnalytics } from 'kenzi-capacitor-marketing-analytics';
const platform = Capacitor.getPlatform();
await KenziMarketingAnalytics.initialize({
firebase: {
enabled: true,
},
meta:
platform === 'android'
? {
enabled: true,
appId: 'YOUR_META_ANDROID_APP_ID',
clientToken: 'YOUR_META_ANDROID_CLIENT_TOKEN',
autoLogAppEventsEnabled: true,
advertiserIDCollectionEnabled: true,
}
: platform === 'ios'
? {
enabled: true,
appId: 'YOUR_META_IOS_APP_ID',
clientToken: 'YOUR_META_IOS_CLIENT_TOKEN',
autoLogAppEventsEnabled: true,
advertiserIDCollectionEnabled: true,
}
: {
enabled: false,
},
});7. Validate builds
After setup:
npm run build
npx cap sync
cd android && ./gradlew :app:assembleDebugFor iOS, open the generated Xcode project/workspace and let Swift Package Manager resolve packages, then build the app target.
8. Validate tracking
- Firebase: use Firebase DebugView / GA4 realtime reporting.
- Meta: use Meta Events Manager / Event Debugging.
- Meta install events only fire on a fresh install.
- Meta event reporting can be delayed.
- Android release builds need the release signing key hash configured in Meta.
Configuration
The plugin supports two configuration approaches.
1. Native platform configuration
Use this for production apps. Provider credentials remain in native project files, match each SDK's documented setup, and are available before JavaScript starts.
Firebase:
- Android: add
google-services.jsonto the app module and apply the Google Services Gradle plugin. - iOS: add
GoogleService-Info.plistto the app target. - Do not pass Firebase credentials from JavaScript. Runtime Firebase initialization is intentionally reserved for a future version.
Meta:
- Android: configure the Facebook App ID and Client Token in
AndroidManifest.xmlresources or manifest metadata. - iOS: configure
FacebookAppID,FacebookClientToken, and related URL schemes inInfo.plist. - Use the Meta Client Token, not the App Secret.
- Never ship the Meta App Secret in Android, iOS, or JavaScript code. The App Secret is only for trusted server-side integrations.
Then initialize only with enabled providers:
import {
KenziMarketingAnalytics,
KENZI_MARKETING_EVENTS,
} from 'kenzi-capacitor-marketing-analytics';
await KenziMarketingAnalytics.initialize({
firebase: {
enabled: true,
},
meta: {
enabled: true,
autoLogAppEventsEnabled: true,
advertiserIDCollectionEnabled: true,
},
});2. Runtime JavaScript overrides
Use this when an app must select Meta credentials at runtime, such as multi-tenant or white-label builds. Prefer native configuration when credentials are fixed per binary.
await KenziMarketingAnalytics.initialize({
meta: {
enabled: true,
appId: '123456789',
clientToken: 'xxxxxxxx',
autoLogAppEventsEnabled: true,
advertiserIDCollectionEnabled: true,
},
});clientToken is the Meta/Facebook SDK Client Token from the Meta Developer Console. It is not the App Secret. Do not pass an App Secret here.
Firebase runtime credentials are not required or accepted by default. The Firebase provider expects the standard native setup above.
Usage
import {
KenziMarketingAnalytics,
KENZI_MARKETING_EVENTS,
} from 'kenzi-capacitor-marketing-analytics';
await KenziMarketingAnalytics.initialize({
debug: true,
firebase: {
enabled: true,
},
meta: {
enabled: true,
autoLogAppEventsEnabled: true,
advertiserIDCollectionEnabled: true,
},
});
await KenziMarketingAnalytics.logEvent({
name: KENZI_MARKETING_EVENTS.COMPLETE_REGISTRATION,
params: {
method: 'phone',
},
});
await KenziMarketingAnalytics.setUserId({
userId: '12345',
});
await KenziMarketingAnalytics.setUserProperty({
key: 'language',
value: 'en',
});
await KenziMarketingAnalytics.trackPurchase({
amount: 99.99,
currency: 'USD',
});debug: true enables native IDE logs:
- Android Logcat tag:
***kenzi-marketing*** - Xcode console prefix:
***kenzi-marketing***
The plugin logs initialization, enabled providers, event dispatches, provider-specific event names, parameters, user property calls, purchases, and native errors. Disable this for normal production releases unless you intentionally want verbose analytics diagnostics.
User properties
setUserProperty sets a user-scoped attribute, not an event.
Use it only for stable segmentation values that describe the current user and change infrequently. Treat user properties as a controlled analytics schema, not as arbitrary key/value storage.
await KenziMarketingAnalytics.setUserProperty({
key: 'language',
value: 'en',
});Recommended standard user properties:
| Property | Purpose | Example values |
| --- | --- | --- |
| language | User's selected app/content language | en, ar |
| country | User's country or market, preferably ISO-style where possible | AE, SA, JO |
| account_type | Commercial or product account segment | free, paid, business |
| subscription_status | Current subscription lifecycle state | none, trial, active, expired, cancelled |
| user_role | User role inside the app | customer, provider, admin |
| signup_method | Original signup method or channel | phone, email, google, apple |
Naming standards:
- Use lowercase
snake_case. - Keep names short and descriptive.
- Keep values low-cardinality and report-friendly.
- Use consistent enumerated values across Android, iOS, and web.
- Register important Firebase user properties as custom definitions where needed for reporting.
Avoid:
- Names, emails, phone numbers, IDs, or other personally identifiable information
- High-cardinality values such as unique order IDs, session IDs, timestamps, or free text
- Event-like data such as
clicked_buttonorcompleted_registration; those should be events
Provider support:
- Firebase Analytics supports user properties.
- Meta App Events does not have a direct equivalent to Firebase user properties in this plugin, so Meta ignores
setUserProperty.
Firebase notes:
- User property names should be planned and registered as custom definitions where needed for reporting.
- Keep names short, lowercase, and snake_case.
- Firebase limits the number of custom user properties per project, so treat them as a controlled analytics schema.
- Firebase user property names are limited, so avoid creating project-specific variants such as
user_language,profile_language, andcontent_languageunless they represent genuinely different dimensions.
Event naming strategy
Use one application-level event contract in your Ionic app, then let this plugin translate that event to the correct provider-specific name before sending it.
Do not scatter Firebase or Meta event names across product code. Firebase/GA4 and Meta/Facebook do not always use the same standard event names. For example, a registration event can be represented as:
- App/business event:
complete_registration - Firebase/GA4 recommended event:
sign_up - Meta App Events standard event:
fb_mobile_complete_registration
For mobile navigation, prefer screen_view for native apps. page_view is common in web analytics and GA4 web streams, while Firebase mobile apps commonly report screens. Meta Pixel has a web PageView standard event, but Meta native App Events does not use the same web Pixel event name. This plugin maps both page_view and screen_view to Meta's closest app-event equivalent, fb_mobile_content_view.
For Firebase screen reports, pass screen_name. The plugin also sends it to Firebase using the provider-standard screen parameter so it appears correctly in Firebase/GA4 screen reporting:
await KenziMarketingAnalytics.logEvent({
name: KENZI_MARKETING_EVENTS.SCREEN_VIEW,
params: {
screen_name: 'home',
screen_class: 'HomePage',
},
});screen_name is the important reporting value. screen_class is optional, but recommended for Capacitor/Ionic apps because the native default can be generic, such as MainActivity or CAPBridgeViewController.
If you manually send screen_view, disable Firebase automatic screen reporting in the native app configuration. Otherwise Firebase can also create automatic screen_view events, and those may appear with only generic parameters such as firebase_screen_class and firebase_screen_id.
The preferred pattern is:
await KenziMarketingAnalytics.logEvent({
name: 'complete_registration',
params: {
method: 'phone',
},
});Event name autocomplete
The plugin exports readable event constants for TypeScript autocomplete:
import {
KENZI_MARKETING_EVENTS,
KENZI_STANDARD_MARKETING_EVENTS,
type StandardMarketingEventName,
} from 'kenzi-capacitor-marketing-analytics';Use KENZI_MARKETING_EVENTS when you want readable dot-autocomplete in your editor:
await KenziMarketingAnalytics.logEvent({
name: KENZI_MARKETING_EVENTS.SCREEN_VIEW,
params: {
screen_name: 'home',
},
});Do not use dot access on KENZI_STANDARD_MARKETING_EVENTS; that export is an array of string values for iteration and validation lists.
Use KENZI_STANDARD_MARKETING_EVENTS when you need the full list of standard event string values:
for (const eventName of KENZI_STANDARD_MARKETING_EVENTS) {
console.log(eventName);
}
const isStandardEvent = KENZI_STANDARD_MARKETING_EVENTS.includes('screen_view');Do not write this:
KENZI_STANDARD_MARKETING_EVENTS.SCREEN_VIEW;Use this instead:
KENZI_MARKETING_EVENTS.SCREEN_VIEW;In Ionic/Angular pages, the usual pattern is:
import {
KenziMarketingAnalytics,
KENZI_MARKETING_EVENTS,
} from 'kenzi-capacitor-marketing-analytics';
await KenziMarketingAnalytics.logEvent({
name: KENZI_MARKETING_EVENTS.SCREEN_VIEW,
params: {
screen_name: 'home',
},
});logEvent.name accepts both standard event names and custom strings. This means editors can suggest readable constants such as COMPLETE_REGISTRATION, LEAD, BEGIN_CHECKOUT, and PURCHASE, while product teams can still send app-specific events when needed:
await KenziMarketingAnalytics.logEvent({
name: 'my_project_specific_event',
});You can skip autocomplete entirely by typing your own string. The autocomplete list is a developer convenience only; it does not restrict runtime behavior.
By default, logEvent maps known standard business events to provider standard events where a standard equivalent exists. If no standard equivalent exists for a provider, the plugin forwards the app event as a custom event, as long as the event name and parameters satisfy that provider's naming rules.
To bypass provider standard mapping and send the raw event name to selected providers:
await KenziMarketingAnalytics.logEvent({
name: 'internal_experiment_seen',
params: {
variant: 'A',
},
useProviderStandardEvents: false,
});For revenue events, prefer the dedicated helper:
await KenziMarketingAnalytics.trackPurchase({
amount: 99.99,
currency: 'USD',
params: {
transaction_id: 'order_1001',
item_id: 'sku_123',
item_name: 'Wireless Headphones',
},
});trackPurchase maps to the native purchase event for each enabled provider.
Built-in reusable standard events and current provider mappings:
The examples below use ecommerce-style names and flat parameters that work cleanly across Firebase and Meta. Keep IDs and names as parameters; do not put product names, order IDs, or user data inside the event name itself. For GA4 ecommerce, full items[] array support is intentionally not shown here because this plugin currently exposes flat cross-provider parameters only.
| App event | Firebase event | Meta event | Recommended params example |
| --- | --- | --- | --- |
| sign_up, complete_registration | sign_up | fb_mobile_complete_registration | { method: 'email' } |
| login | login | login | { method: 'email' } |
| page_view | page_view | fb_mobile_content_view | { page_title: 'Product Detail', page_location: '/products/sku_123' } |
| screen_view | screen_view | fb_mobile_content_view | { screen_name: 'product/sku_123', screen_class: 'ProductPage' } |
| search | search | fb_mobile_search | { search_term: 'wireless headphones' } |
| view_content | select_content | fb_mobile_content_view | { content_type: 'product', item_id: 'sku_123', item_name: 'Wireless Headphones' } |
| view_item | view_item | fb_mobile_content_view | { item_id: 'sku_123', item_name: 'Wireless Headphones', item_category: 'electronics', value: 129.99, currency: 'USD' } |
| view_item_list | view_item_list | fb_mobile_content_view | { item_list_id: 'featured_products', item_list_name: 'Featured Products' } |
| select_content | select_content | select_content | { content_type: 'promotion', item_id: 'summer_sale_banner' } |
| select_item | select_item | select_item | { item_list_id: 'featured_products', item_id: 'sku_123', item_name: 'Wireless Headphones' } |
| add_to_cart | add_to_cart | fb_mobile_add_to_cart | { item_id: 'sku_123', item_name: 'Wireless Headphones', quantity: 1, value: 129.99, currency: 'USD' } |
| add_to_wishlist | add_to_wishlist | fb_mobile_add_to_wishlist | { item_id: 'sku_123', item_name: 'Wireless Headphones' } |
| add_payment_info | add_payment_info | fb_mobile_add_payment_info | { payment_type: 'card' } |
| begin_checkout | begin_checkout | fb_mobile_initiated_checkout | { value: 129.99, currency: 'USD', coupon: 'SUMMER10' } |
| add_shipping_info | add_shipping_info | add_shipping_info | { shipping_tier: 'standard', value: 129.99, currency: 'USD' } |
| purchase | purchase | fb_mobile_purchase | Prefer trackPurchase({ amount, currency }) |
| refund | refund | refund | { transaction_id: 'order_1001', value: 129.99, currency: 'USD' } |
| lead, generate_lead | generate_lead | Lead | { lead_type: 'back_in_stock', item_id: 'sku_123' } |
| contact | contact | Contact | { method: 'live_chat', page_location: '/support' } |
| schedule | schedule | Schedule | { item_category: 'delivery', delivery_window: 'tomorrow_morning' } |
| subscribe | subscribe | Subscribe | { plan: 'premium_monthly', value: 19.99, currency: 'USD' } |
| start_trial | start_trial | StartTrial | { plan: 'premium_monthly', trial_days: 14 } |
| tutorial_begin | tutorial_begin | tutorial_begin | { tutorial_name: 'shopping_onboarding' } |
| tutorial_complete | tutorial_complete | fb_mobile_tutorial_completion | { tutorial_name: 'shopping_onboarding' } |
| share | share | share | { method: 'native_share', content_type: 'product', item_id: 'sku_123' } |
| invite | invite | invite | { method: 'referral_link' } |
| rate | rate | fb_mobile_rate | { value: 5, item_id: 'sku_123' } |
| unlock_achievement | unlock_achievement | fb_mobile_achievement_unlocked | { achievement_id: 'first_purchase' } |
| spend_credits | spend_virtual_currency | fb_mobile_spent_credits | { virtual_currency_name: 'store_credits', value: 10 } |
| earn_virtual_currency | earn_virtual_currency | earn_virtual_currency | { virtual_currency_name: 'loyalty_points', value: 100 } |
| level_start | level_start | level_start | { level_name: 'loyalty_tier_silver' } |
| level_end | level_end | level_end | { level_name: 'loyalty_tier_silver', success: true } |
| level_up | level_up | level_up | { level: 2, level_name: 'loyalty_tier_gold' } |
| post_score | post_score | post_score | { score: 95, score_type: 'profile_completion' } |
| join_group | join_group | join_group | { group_id: 'vip_customers' } |
| campaign_open | campaign_open | campaign_open | { campaign: 'summer_sale_2026' } |
| notification_open | notification_open | notification_open | { campaign: 'abandoned_cart', item_id: 'sku_123' } |
Project-specific funnel events, such as healthcare booking steps, marketplace-specific actions, or internal product milestones, should still use logEvent. Keep those names generic enough for reporting and avoid sending user-identifying values as event names or high-cardinality parameters.
Route an operation to specific providers:
await KenziMarketingAnalytics.logEvent({
name: 'campaign_landing_view',
params: {
campaign: 'ramadan_2026',
},
providers: ['firebase'],
});API
initialize(...)logEvent(...)setUserId(...)setUserProperty(...)trackPurchase(...)- Interfaces
- Type Aliases
initialize(...)
initialize(options?: KenziMarketingAnalyticsConfig | undefined) => Promise<InitializeResult>| Param | Type |
| ------------- | --------------------------------------------------------------------------------------- |
| options | KenziMarketingAnalyticsConfig |
Returns: Promise<InitializeResult>
logEvent(...)
logEvent(options: LogEventOptions) => Promise<void>| Param | Type |
| ------------- | ----------------------------------------------------------- |
| options | LogEventOptions |
setUserId(...)
setUserId(options: SetUserIdOptions) => Promise<void>| Param | Type |
| ------------- | ------------------------------------------------------------- |
| options | SetUserIdOptions |
setUserProperty(...)
setUserProperty(options: SetUserPropertyOptions) => Promise<void>| Param | Type |
| ------------- | ------------------------------------------------------------------------- |
| options | SetUserPropertyOptions |
trackPurchase(...)
trackPurchase(options: TrackPurchaseOptions) => Promise<void>| Param | Type |
| ------------- | --------------------------------------------------------------------- |
| options | TrackPurchaseOptions |
Interfaces
InitializeResult
| Prop | Type |
| ---------------------- | -------------------------------- |
| enabledProviders | AnalyticsProvider[] |
KenziMarketingAnalyticsConfig
| Prop | Type | Description |
| -------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| debug | boolean | Enables native debug logging in Android Logcat and Xcode console. Logs are prefixed with kenzi-marketing. |
| firebase | FirebaseAnalyticsConfig | |
| meta | MetaAnalyticsConfig | |
FirebaseAnalyticsConfig
| Prop | Type | Description |
| ------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| enabled | boolean | Enables Firebase Analytics. Firebase uses native platform configuration by default: - Android: google-services.json - iOS: GoogleService-Info.plist |
MetaAnalyticsConfig
| Prop | Type | Description |
| ----------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| enabled | boolean | Enables Meta/Facebook App Events. |
| appId | string | Optional runtime override for the Facebook App ID. Prefer native Info.plist/AndroidManifest configuration for production apps. |
| clientToken | string | Optional runtime override for the Facebook client token. Prefer native Info.plist/AndroidManifest configuration for production apps. |
| autoLogAppEventsEnabled | boolean | Enables or disables Meta automatic app event logging. |
| advertiserIDCollectionEnabled | boolean | Enables or disables advertiser ID collection in the Meta SDK. |
LogEventOptions
| Prop | Type | Description |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name | 'sign_up' | 'complete_registration' | 'login' | 'page_view' | 'screen_view' | 'search' | 'view_content' | 'select_content' | 'view_item' | 'view_item_list' | 'select_item' | 'add_to_cart' | 'add_to_wishlist' | 'add_payment_info' | 'begin_checkout' | 'add_shipping_info' | 'purchase' | 'refund' | 'lead' | 'generate_lead' | 'contact' | 'schedule' | 'subscribe' | 'start_trial' | 'tutorial_begin' | 'tutorial_complete' | 'share' | 'invite' | 'rate' | 'unlock_achievement' | 'spend_credits' | 'earn_virtual_currency' | 'level_start' | 'level_end' | 'level_up' | 'post_score' | 'join_group' | 'campaign_open' | 'notification_open' | CustomMarketingEventName | |
| params | AnalyticsParams | |
| useProviderStandardEvents | boolean | Defaults to true. When true, known standard business event names are translated to the closest provider-specific standard event names before being sent. |
| providers | AnalyticsProvider[] | |
SetUserIdOptions
| Prop | Type |
| --------------- | -------------------------------- |
| userId | string | null |
| providers | AnalyticsProvider[] |
SetUserPropertyOptions
| Prop | Type | Description |
| --------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| key | string | User-scoped property name. Firebase supports user properties. Meta App Events does not have a direct equivalent for this API, so unsupported providers ignore this call. |
| value | string | null | User-scoped property value. Pass null to clear the value where supported. |
| providers | AnalyticsProvider[] | |
TrackPurchaseOptions
| Prop | Type |
| --------------- | ----------------------------------------------------------- |
| amount | number |
| currency | string |
| params | AnalyticsParams |
| providers | AnalyticsProvider[] |
Type Aliases
AnalyticsProvider
'firebase' | 'meta'
StandardMarketingEventName
(typeof KENZI_STANDARD_MARKETING_EVENTS)[number]
CustomMarketingEventName
string & Record<never, never>
Record
Construct a type with a set of properties K of type T
{ [P in K]: T; }
AnalyticsParams
Record<string, AnalyticsParamValue>
AnalyticsParamValue
string | number | boolean | null
