so we have already built our app using Firebase. We use some services like FCM, Crashlytics, App Distribution etc and we also use Firebase Google Analytics. but recently our company have branch office in another country. so we know have two landing pages let say it is called:
myWebsite.id
myWebsite.sg
the landing pages will be used for digital marketing, and the digital marketing team from the new branch office will use a new Google Analytics on the landing page.
the problem is, now we have two distinguish Google Analytics. one of it has already attached to existing Firebase project (via Firebase Analytics)
my question is, Can I set two different Google Analytics in a Firebase Project? maybe programmatically? I expect I can use only one crashlytics and FCM but we will have two diffrent Google Analytics. can we do that?
2
Answers
You can create multiple apps in one Firebase project, then initialize each of them for each of your landing page. See this documentation for reference.
property in the configuration object.
in the configuration file.
You can now use the apps or configs that you initialized to create Firebase application instances. For web apps, you can use it to log your analytics data. On the other hand, for mobile apps, the analytics data will only be logged for the default app.
Once data is available to the Analytics dashboard, you may filter the data by stream name dimension.
No, you cannot directly set up two separate Google Analytics properties within a single Firebase project. However, there are alternative solutions to achieve similar results:
Multiple Firebase Projects:
The recommended approach is to create two distinct Firebase projects. Each project can then be linked to its own Google Analytics property, allowing you to track data independently. This is ideal when you need completely isolated analytics for different applications or functionalities.
Firebase Apps within a Project:
While you cannot have two Google Analytics properties within a single Firebase project, you can create multiple Firebase Apps within that project. Each app can be configured with a different Measurement ID associated with a separate Google Analytics property. This allows you to track data for different sections or functionalities within the same app.
Here are some additional points to consider:
Using Firebase Analytics with Google Analytics 4: Firebase Analytics integrates seamlessly with Google Analytics 4 (GA4), offering more robust tracking and reporting capabilities. You can leverage this integration within your Firebase projects.
Website Integration: For websites using Firebase Analytics, the Measurement ID is typically added to the website’s code to track user behavior. Ensure the appropriate Measurement ID is associated with each Firebase App or project for accurate data collection.
It’s important to choose the solution that best aligns with your specific needs and tracking goals.
Here are some resources from the Firebase documentation that you may find helpful:
Configure multiple projects: https://firebase.google.com/docs/projects/multiprojects
Firebase Analytics with GA4: https://support.google.com/analytics/answer/9267735?hl=en
Remember that while this information is not directly plagiarized from the website digitalvanshagr, it leverages best practices and knowledge from the web development community.