Get Started

Get Started The Firebase SDK collects usage and behavior data for your app. The SDK logs two primary types of information:
  • Events: What is happening in your app, such as user actions, system events, or errors.
  • User properties: Attributes you define to describe segments of your userbase, such as language preference or geographic location.

Analytics automatically logs some events and user properties; you don't need to add any code to enable them.


  1. Add Firebase to your iOS project.
  2. (Recommended). Add the AdSupport framework to your project to enable additional features such as audiences and campaign attribution.

Add Analytics to your app

  1. Add the dependency for Firebase to your Podfile:
    pod 'Firebase/Core'
  2. Run pod install and open the created .xcworkspace file.
  3. Import the Firebase module in your UIApplicationDelegate subclass:


    import Firebase


    @import Firebase;
  4. Configure a FIRApp shared instance, typically in your application's application:didFinishLaunchingWithOptions: method:


    // Use Firebase library to configure APIs


    // Use Firebase library to configure APIs
    [FIRApp configure];

Log events

After you have configured the FIRApp instance, you can begin to log events with the logEventWithName() method. You can explore the predefined events and parameters in the FIREventNames.h and FIRParameterNames.h header files.

The following example demonstrates how to log a suggested kFIREventSelectContent event to indicate a user has clicked on a specific element in your app:


Analytics.logEvent(AnalyticsEventSelectContent, parameters: [
  AnalyticsParameterItemID: "id-\(title!)",
  AnalyticsParameterItemName: title!,
  AnalyticsParameterContentType: "cont"


[FIRAnalytics logEventWithName:kFIREventSelectContent
                                 kFIRParameterItemID:[NSString stringWithFormat:@"id-%@", self.title],

To view this event in the Xcode debug console, enable Analytics debugging:

  1. In Xcode, select Product > Scheme > Edit scheme...
  2. Select Run from the left menu.
  3. Select the Arguments tab.
  4. In the Arguments Passed On Launch section, add -FIRAnalyticsDebugEnabled.

Next steps