@captive/capacitor-facebook-analytics v5.0.2
capacitor-facebook-analytics
this is a capacitor 4 plugin for facebook analytics
Install
yarn install capacitor-facebook-analytics
npx cap sync
Usage
import { FacebookAnalytics, FacebookEventName } from '@captive/capacitor-facebook-analytics';
// enable advertiser tracking for IOS
FacebookAnalytics.enableAdvertiserTracking();
// log event : completed registration
FacebookAnalytics.logEvent({ event: FacebookEventName.CompletedRegistration });
API
initAppEvents()
logEvent(...)
enableAdvertiserTracking()
disableAdvertiserTracking()
getAdvertiserTrackingStatus()
- Type Aliases
initAppEvents()
initAppEvents() => Promise<string>
Returns: Promise<string>
logEvent(...)
logEvent(options: { event: FacebookEventName | string; valueToSum?: number; params?: any; }) => Promise<string>
Send an event to Facebook
FacebookAnalytics.logEvent({ event: <a href="#facebookeventname">FacebookEventName</a>.CompletedRegistration })
// OR
FacebookAnalytics.logEvent({ event: 'fb_mobile_complete_registration' })
Param | Type |
---|---|
options | { event: string; valueToSum?: number; params?: any; } |
Returns: Promise<string>
enableAdvertiserTracking()
enableAdvertiserTracking() => Promise<void>
Only for IOS versions greater than 14
disableAdvertiserTracking()
disableAdvertiserTracking() => Promise<void>
getAdvertiserTrackingStatus()
getAdvertiserTrackingStatus() => Promise<boolean>
Returns: Promise<boolean>
Type Aliases
FacebookEventName
Enum of all Facebook standard events
Table of correspondence :
ActivatedApp: 'fb_mobile_activate_app', DeactivatedApp: 'fb_mobile_deactivate_app', SessionInterruptions: 'fb_mobile_app_interruptions', TimeBetweenSessions: 'fb_mobile_time_between_sessions', CompletedRegistration: 'fb_mobile_complete_registration', ViewedContent: 'fb_mobile_content_view', Searched: 'fb_mobile_search', Rated: 'fb_mobile_rate', CompletedTutorial: 'fb_mobile_tutorial_completion', PushTokenObtained: 'fb_mobile_obtain_push_token', AddedToCart: 'fb_mobile_add_to_cart', AddedToWishlist: 'fb_mobile_add_to_wishlist', InitiatedCheckout: 'fb_mobile_initiated_checkout', AddedPaymentInfo: 'fb_mobile_add_payment_info', Purchased: 'fb_mobile_purchase', AchievedLevel: 'fb_mobile_level_achieved', UnlockedAchievement: 'fb_mobile_achievement_unlocked', SpentCredits: 'fb_mobile_spent_credits',
(typeof FacebookEventName)keyof typeof FacebookEventName
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago