Send your event data from RudderStack to Firebase.
9 minute read
Firebase is a popular mobile platform powered by Google. It helps you to quickly develop high-quality, enterprise-grade applications and grow your business.
RudderStack supports Firebase as a mobile device mode to which you can seamlessly send your customer data for analytics.
Firebase device mode support is not available for the Cordova SDK.
Follow these steps to add Firebase to your Unity project:
Register your project in the Firebase Console. Currently, RudderStack supports only Android and iOS platforms for Unity.
After adding the project, Firebase will prompt you to download the google-services.json for Android and GoogleServices-Info.plist for iOS.
Add those two files to your project’s Assets folder.
Integrate the RudderStack core SDK with your project. For more information, refer to the Unity SDK documentation.
Download and import the Firebase Unity SDK and follow the instructions to add the Firebase SDK (specifically, FirebaseAnalytics.unitypackage) to your project.
Attach the RudderPreferbs.prefab file from Rudder to your main GameObject
Finally, change the SDK initialization using the following code snippet:
// Build your config
RudderConfigBuilderconfigBuilder=newRudderConfigBuilder().WithEndPointUrl(<data_plane_url>).WithFactory(RudderFirebaseIntegrationFactory.GetFactory());// get instance for RudderClient
RudderClientrudderClient=RudderClient.GetInstance(<source_write_key>,configBuilder.Build());
Use the latest version of the Firebase React Native device mode to get the latest updates and performance enhancements.
Follow these steps to add Firebase to your React Native project:
Register your Android and iOS applications in the Firebase console.
Once you have successfully created the applications in the Firebase console, you will be prompted to download the google-services.json and GoogleServices-Info.plist files.
Navigate to your app’s android folder and follow the steps below:
Copy the google-services.json file in the app folder of your Android project. This file contains all necessary information about the project and the integration.
Add the classpath under dependencies to your project level build.gradle file:
buildscript{repositories{google()}dependencies{// add this line
classpath'com.google.gms:google-services:4.3.3'}}
Once you have completed the steps above, you can add the plugins and dependencies to your app/build.gradle file:
For React-Native Firebase version 1.0.16 and above, if you encounter any static libraries issue while installing the Rudder-Firebase pods, add the below lines in your iOS app’s Podfile:
Navigate to your app’s android folder and follow the below steps:
Copy the google-services.json file in the app folder of your Android project. This file contains all necessary information about the project and the integration.
Add the classpath under dependencies to your project level build.gradle file:
buildscript{repositories{google()}dependencies{// add this line
classpath'com.google.gms:google-services:4.3.3'}}
Add mavenCentral() as a repository under buildscript.repositories and allprojects.repositories to your project level build.gradle file:
buildscript{repositories{google()// should be added
mavenCentral()}dependencies{classpath'com.google.gms:google-services:4.3.3'}}allprojects{repositories{google()// should be added
mavenCentral()}}
Next, add the plugins and dependencies to your app/build.gradle file:
Finally, navigate to your app’s iOS folder and add the GoogleServices-Info.plist file to the root of your XCode project.
Identify
The identify call sets the userId through the setUserId method from FirebaseAnalytics. RudderStack sets the other user properties from RudderTraits to Firebase using the setUserProperty method.
RudderStack ignores age, gender, and interest, as these properties are reserved by Google.
RudderStack’s track events are mapped to the standard Firebase events wherever possible.
Event mapping
RudderStack maps the following events to the standard Firebase events:
RudderStack Event
Firebase Event
Payment Info Entered
add_payment_info
Product Added
add_to_cart
Product Added to Wishlist
add_to_wishlist
Application Opened
app_open
Checkout Started
begin_checkout
Order Completed
purchase
Order Refunded
refund
Products Searched
search
Cart Shared
share
Product Shared
share
Product Viewed
view_item
Product List Viewed
view_item_list
Product Removed
remove_from_cart
Product Clicked
select_content
Promotion Viewed
view_promotion
Promotion Clicked
select_promotion
Cart Viewed
view_cart
The following Firebase events are not mapped to any RudderStack event:
number_of_nights
number_of_rooms
number_of_passengers
origin
destination
start_date
end_date
travel_class
item_list_name
creative_slot
location_id
transaction_id
screen_class
RudderStack passes all event-related properties to Firebase. The nested values in the properties are converted to JSON using GSON.
Property mapping
RudderStack maps the following event properties to the standard Firebase properties:
RudderStack property
Firebase property
category
item_category
cart_id,product_id
item_id
share_via
method
query
search_term
revenue, value, total
value
currency
currency
tax
tax
shipping
shipping
coupon
coupon
name
name, promotion_name
quantity
quantity
price
price
payment_method
payment_type
list_id
item_list_id
promotion_id
promotion_id
creative
creative_name
affiliation
affiliation
Along with mapping the above list of the standard property names, RudderStack exhibits the following behavior:
Converts the event names to the lower case.
Trims the whitespaces at the start and the end.
Replaces a space with an underscore.
Firebase enforces a strict event name length limit of 40 characters. RudderStack takes a substring of 40 characters (from the beginning) if the event names exceed this permitted value.
A sample track call sent from the iOS SDK is shown below:
This site uses cookies to improve your experience while you navigate through the website. Out of
these
cookies, the cookies that are categorized as necessary are stored on your browser as they are as
essential
for the working of basic functionalities of the website. We also use third-party cookies that
help
us
analyze and understand how you use this website. These cookies will be stored in your browser
only
with
your
consent. You also have the option to opt-out of these cookies. But opting out of some of these
cookies
may
have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This
category only includes cookies that ensures basic functionalities and security
features of the website. These cookies do not store any personal information.
This site uses cookies to improve your experience. If you want to
learn more about cookies and why we use them, visit our cookie
policy. We'll assume you're ok with this, but you can opt-out if you wish Cookie Settings.