No Description

FIRAnalytics.h 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #import <Foundation/Foundation.h>
  2. #import "FIREventNames.h"
  3. #import "FIRParameterNames.h"
  4. #import "FIRUserPropertyNames.h"
  5. NS_ASSUME_NONNULL_BEGIN
  6. /// The top level Firebase Analytics singleton that provides methods for logging events and setting
  7. /// user properties. See <a href="http://goo.gl/gz8SLz">the developer guides</a> for general
  8. /// information on using Firebase Analytics in your apps.
  9. NS_SWIFT_NAME(Analytics)
  10. @interface FIRAnalytics : NSObject
  11. /// Logs an app event. The event can have up to 25 parameters. Events with the same name must have
  12. /// the same parameters. Up to 500 event names are supported. Using predefined events and/or
  13. /// parameters is recommended for optimal reporting.
  14. ///
  15. /// The following event names are reserved and cannot be used:
  16. /// <ul>
  17. /// <li>ad_activeview</li>
  18. /// <li>ad_click</li>
  19. /// <li>ad_exposure</li>
  20. /// <li>ad_impression</li>
  21. /// <li>ad_query</li>
  22. /// <li>adunit_exposure</li>
  23. /// <li>app_clear_data</li>
  24. /// <li>app_remove</li>
  25. /// <li>app_update</li>
  26. /// <li>error</li>
  27. /// <li>first_open</li>
  28. /// <li>in_app_purchase</li>
  29. /// <li>notification_dismiss</li>
  30. /// <li>notification_foreground</li>
  31. /// <li>notification_open</li>
  32. /// <li>notification_receive</li>
  33. /// <li>os_update</li>
  34. /// <li>screen_view</li>
  35. /// <li>session_start</li>
  36. /// <li>user_engagement</li>
  37. /// </ul>
  38. ///
  39. /// @param name The name of the event. Should contain 1 to 40 alphanumeric characters or
  40. /// underscores. The name must start with an alphabetic character. Some event names are
  41. /// reserved. See FIREventNames.h for the list of reserved event names. The "firebase_",
  42. /// "google_", and "ga_" prefixes are reserved and should not be used. Note that event names are
  43. /// case-sensitive and that logging two events whose names differ only in case will result in
  44. /// two distinct events.
  45. /// @param parameters The dictionary of event parameters. Passing nil indicates that the event has
  46. /// no parameters. Parameter names can be up to 40 characters long and must start with an
  47. /// alphabetic character and contain only alphanumeric characters and underscores. Only NSString
  48. /// and NSNumber (signed 64-bit integer and 64-bit floating-point number) parameter types are
  49. /// supported. NSString parameter values can be up to 100 characters long. The "firebase_",
  50. /// "google_", and "ga_" prefixes are reserved and should not be used for parameter names.
  51. + (void)logEventWithName:(NSString *)name
  52. parameters:(nullable NSDictionary<NSString *, id> *)parameters
  53. NS_SWIFT_NAME(logEvent(_:parameters:));
  54. /// Sets a user property to a given value. Up to 25 user property names are supported. Once set,
  55. /// user property values persist throughout the app lifecycle and across sessions.
  56. ///
  57. /// The following user property names are reserved and cannot be used:
  58. /// <ul>
  59. /// <li>first_open_time</li>
  60. /// <li>last_deep_link_referrer</li>
  61. /// <li>user_id</li>
  62. /// </ul>
  63. ///
  64. /// @param value The value of the user property. Values can be up to 36 characters long. Setting the
  65. /// value to nil removes the user property.
  66. /// @param name The name of the user property to set. Should contain 1 to 24 alphanumeric characters
  67. /// or underscores and must start with an alphabetic character. The "firebase_", "google_", and
  68. /// "ga_" prefixes are reserved and should not be used for user property names.
  69. + (void)setUserPropertyString:(nullable NSString *)value forName:(NSString *)name
  70. NS_SWIFT_NAME(setUserProperty(_:forName:));
  71. /// Sets the user ID property. This feature must be used in accordance with
  72. /// <a href="https://www.google.com/policies/privacy">Google's Privacy Policy</a>
  73. ///
  74. /// @param userID The user ID to ascribe to the user of this app on this device, which must be
  75. /// non-empty and no more than 256 characters long. Setting userID to nil removes the user ID.
  76. + (void)setUserID:(nullable NSString *)userID;
  77. /// Sets the current screen name, which specifies the current visual context in your app. This helps
  78. /// identify the areas in your app where users spend their time and how they interact with your app.
  79. /// Must be called on the main thread.
  80. ///
  81. /// Note that screen reporting is enabled automatically and records the class name of the current
  82. /// UIViewController for you without requiring you to call this method. If you implement
  83. /// viewDidAppear in your UIViewController but do not call [super viewDidAppear:], that screen class
  84. /// will not be automatically tracked. The class name can optionally be overridden by calling this
  85. /// method in the viewDidAppear callback of your UIViewController and specifying the
  86. /// screenClassOverride parameter. setScreenName:screenClass: must be called after
  87. /// [super viewDidAppear:].
  88. ///
  89. /// If your app does not use a distinct UIViewController for each screen, you should call this
  90. /// method and specify a distinct screenName each time a new screen is presented to the user.
  91. ///
  92. /// The screen name and screen class remain in effect until the current UIViewController changes or
  93. /// a new call to setScreenName:screenClass: is made.
  94. ///
  95. /// @param screenName The name of the current screen. Should contain 1 to 100 characters. Set to nil
  96. /// to clear the current screen name.
  97. /// @param screenClassOverride The name of the screen class. Should contain 1 to 100 characters. By
  98. /// default this is the class name of the current UIViewController. Set to nil to revert to the
  99. /// default class name.
  100. + (void)setScreenName:(nullable NSString *)screenName
  101. screenClass:(nullable NSString *)screenClassOverride;
  102. /// Sets whether analytics collection is enabled for this app on this device. This setting is
  103. /// persisted across app sessions. By default it is enabled.
  104. ///
  105. /// @param analyticsCollectionEnabled A flag that enables or disables Analytics collection.
  106. + (void)setAnalyticsCollectionEnabled:(BOOL)analyticsCollectionEnabled;
  107. /// Sets the interval of inactivity in seconds that terminates the current session. The default
  108. /// value is 1800 seconds (30 minutes).
  109. ///
  110. /// @param sessionTimeoutInterval The custom time of inactivity in seconds before the current
  111. /// session terminates.
  112. + (void)setSessionTimeoutInterval:(NSTimeInterval)sessionTimeoutInterval;
  113. /// The unique ID for this instance of the application.
  114. + (NSString *)appInstanceID;
  115. /// Clears all analytics data for this instance from the device and resets the app instance ID.
  116. /// FIRAnalyticsConfiguration values will be reset to the default values.
  117. + (void)resetAnalyticsData;
  118. @end
  119. NS_ASSUME_NONNULL_END