Firebase Google Analytics in Xamarin forms

Bhuwan 736 Reputation points
2022-09-27T06:56:09.117+00:00

Hi

how to integrate Firebase Google Analytics in Xamarin Forms. firebase account and key generation already done i need code Example in Xamarin forms

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,366 questions
{count} vote

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 33,091 Reputation points Microsoft Vendor
    2022-09-28T08:47:03.357+00:00

    Hello @Bhuwan ,

    You could config the analytics instance and add the event log in iOS project and Android project.

    On Android: You can initialize the instance in the onCreate() method and log events with the logEvent() method, please see the sample at GitHub.
    On iOS: You can configure APIs in AppDelegate.cs and log events, please check the sample.

    The samples use some Firebase.Analytics nuget packages for Android and iOS, you could check the PackageReference and add them.
    For more details, you can refer to the Firebase doc- Get started with Google Analytics  |  Google Analytics for Firebase

    You may have config the apps in Firebase Console, I'm not clear if you have set up your project. If not, you could add the GoogleService-Info.plist to your iOS project and the google-services.json to your Android project, the Build action for GoogleService-Info.plist should be BundleResource, the Build action for google-services.json should be GoogleServicesJson . And you could check the packagename in AndroidManifest.xml and the Bundle ID in info.plist, then make sure these two values ​​match the values ​​in your console.

    Best Regards,
    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.