-
Notifications
You must be signed in to change notification settings - Fork 0
FCMOptions
FCMOptions
is an Anvil portable class specifically designed to manage options for Firebase Cloud Messaging (FCM). This class allows the specification of additional settings related to FCM, such as analytics labels.
-
analytics_label (str, optional)
: A label associated with the message's analytics data. This label helps in categorizing and filtering messages in Firebase analytics.
Initializes a new instance of the FCMOptions
class, setting the optional analytics label for FCM messages.
-
analytics_label (str, optional)
: The label for analytics. If provided, it helps in tracking the message in Firebase analytics.
Converts the FCMOptions
object into a dictionary. This is particularly useful when passing the options to Firebase SDKs that require dictionary formats.
- The
FCMOptions
class is a convenient way to add extra configurations to your FCM messages, specifically in the context of analytics. - Being an Anvil portable class, it can be passed between client and server code within Anvil applications.
- The use of
analytics_label
helps in gaining insights and tracking message effectiveness in Firebase analytics.
from Firebase.messages import FCMOptions
# Creating FCMOptions with an analytics label
fcm_options = FCMOptions(analytics_label="campaign_123")
# Converting the FCMOptions to a dictionary
fcm_options_dict = fcm_options.to_dict()
print(fcm_options_dict)
In this example, FCMOptions
is instantiated with an analytics label. The to_dict
method converts it into a dictionary format, making it ready to be integrated with Firebase SDKs or other parts of a Firebase application where such options are required. This approach is particularly useful for tracking and analyzing the performance of FCM messages through Firebase analytics.
Home - Quick Start
Client
Messages
- Message
- SimpleMessage
- MulticastMessage
- WebpushConfig
- FCMOptions
- WebpushFCMOptions
- WebpushNotification
- WebpushNotificationAction
- Response
- BatchResponse
- TopicManagementResponse
Server