FIRAnalytics.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. @interface FIRAnalytics : NSObject
  10. /// Logs an app event. The event can have up to 25 parameters. Events with the same name must have
  11. /// the same parameters. Up to 500 event names are supported. Using predefined events and/or
  12. /// parameters is recommended for optimal reporting.
  13. ///
  14. /// The following event names are reserved and cannot be used:
  15. /// <ul>
  16. /// <li>app_clear_data</li>
  17. /// <li>app_remove</li>
  18. /// <li>app_update</li>
  19. /// <li>error</li>
  20. /// <li>first_open</li>
  21. /// <li>in_app_purchase</li>
  22. /// <li>notification_dismiss</li>
  23. /// <li>notification_foreground</li>
  24. /// <li>notification_open</li>
  25. /// <li>notification_receive</li>
  26. /// <li>os_update</li>
  27. /// <li>session_start</li>
  28. /// <li>user_engagement</li>
  29. /// </ul>
  30. ///
  31. /// @param name The name of the event. Should contain 1 to 40 alphanumeric characters or
  32. /// underscores. The name must start with an alphabetic character. Some event names are
  33. /// reserved. See FIREventNames.h for the list of reserved event names. The "firebase_" prefix
  34. /// is reserved and should not be used. Note that event names are case-sensitive and that
  35. /// logging two events whose names differ only in case will result in two distinct events.
  36. /// @param parameters The dictionary of event parameters. Passing nil indicates that the event has
  37. /// no parameters. Parameter names can be up to 40 characters long and must start with an
  38. /// alphabetic character and contain only alphanumeric characters and underscores. Only NSString
  39. /// and NSNumber (signed 64-bit integer and 64-bit floating-point number) parameter types are
  40. /// supported. NSString parameter values can be up to 100 characters long. The "firebase_"
  41. /// prefix is reserved and should not be used for parameter names.
  42. + (void)logEventWithName:(NSString *)name
  43. parameters:(nullable NSDictionary<NSString *, id> *)parameters;
  44. /// Sets a user property to a given value. Up to 25 user property names are supported. Once set,
  45. /// user property values persist throughout the app lifecycle and across sessions.
  46. ///
  47. /// The following user property names are reserved and cannot be used:
  48. /// <ul>
  49. /// <li>first_open_time</li>
  50. /// <li>last_deep_link_referrer</li>
  51. /// <li>user_id</li>
  52. /// </ul>
  53. ///
  54. /// @param value The value of the user property. Values can be up to 36 characters long. Setting the
  55. /// value to nil removes the user property.
  56. /// @param name The name of the user property to set. Should contain 1 to 24 alphanumeric characters
  57. /// or underscores and must start with an alphabetic character. The "firebase_" prefix is
  58. /// reserved and should not be used for user property names.
  59. + (void)setUserPropertyString:(nullable NSString *)value forName:(NSString *)name;
  60. /// Sets the user ID property. This feature must be used in accordance with
  61. /// <a href="https://www.google.com/policies/privacy">Google's Privacy Policy</a>
  62. ///
  63. /// @param userID The user ID to ascribe to the user of this app on this device, which must be
  64. /// non-empty and no more than 36 characters long. Setting userID to nil removes the user ID.
  65. + (void)setUserID:(nullable NSString *)userID;
  66. /// Sets the current screen name, which specifies the current visual context in your app. This helps
  67. /// identify the areas in your app where users spend their time and how they interact with your app.
  68. ///
  69. /// Note that screen reporting is enabled automatically and records the class name of the current
  70. /// UIViewController for you without requiring you to call this method. If you implement
  71. /// viewDidAppear in your UIViewController but do not call [super viewDidAppear:], that screen class
  72. /// will not be automatically tracked. The class name can optionally be overridden by calling this
  73. /// method in the viewDidAppear callback of your UIViewController and specifying the
  74. /// screenClassOverride parameter.
  75. ///
  76. /// If your app does not use a distinct UIViewController for each screen, you should call this
  77. /// method and specify a distinct screenName each time a new screen is presented to the user.
  78. ///
  79. /// The screen name and screen class remain in effect until the current UIViewController changes or
  80. /// a new call to setScreenName:screenClass: is made.
  81. ///
  82. /// @param screenName The name of the current screen. Should contain 1 to 100 characters. Set to nil
  83. /// to clear the current screen name.
  84. /// @param screenClassOverride The name of the screen class. Should contain 1 to 100 characters. By
  85. /// default this is the class name of the current UIViewController. Set to nil to revert to the
  86. /// default class name.
  87. + (void)setScreenName:(nullable NSString *)screenName
  88. screenClass:(nullable NSString *)screenClassOverride;
  89. /// The unique ID for this instance of the application.
  90. + (NSString *)appInstanceID;
  91. @end
  92. NS_ASSUME_NONNULL_END