Flurry.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818
  1. //
  2. // Flurry.h
  3. // Flurry iOS Analytics Agent
  4. //
  5. // Copyright 2009-2012 Flurry, Inc. All rights reserved.
  6. //
  7. // Methods in this header file are for use with Flurry Analytics
  8. #import <UIKit/UIKit.h>
  9. /*!
  10. * @brief Provides all available methods for defining and reporting Analytics from use
  11. * of your app.
  12. *
  13. * Set of methods that allow developers to capture detailed, aggregate information
  14. * regarding the use of their app by end users.
  15. *
  16. * @note This class provides methods necessary for correct function of FlurryAds.h.
  17. * For information on how to use Flurry's Ads SDK to
  18. * attract high-quality users and monetize your user base see <a href="http://support.flurry.com/index.php?title=Publishers">Support Center - Publishers</a>.
  19. *
  20. * @author 2009 - 2013 Flurry, Inc. All Rights Reserved.
  21. * @version 4.3.0
  22. *
  23. */
  24. /*!
  25. * @brief Enum for setting up log output level.
  26. * @since 4.2.0
  27. *
  28. */
  29. typedef enum {
  30. FlurryLogLevelNone = 0, //No output
  31. FlurryLogLevelCriticalOnly, //Default, outputs only critical log events
  32. FlurryLogLevelDebug, //Debug level, outputs critical and main log events
  33. FlurryLogLevelAll //Highest level, outputs all log events
  34. } FlurryLogLevel;
  35. @interface Flurry : NSObject {
  36. }
  37. /** @name Pre-Session Calls
  38. * Optional sdk settings that should be called before start session.
  39. */
  40. //@{
  41. /*!
  42. * @brief Explicitly specifies the App Version that Flurry will use to group Analytics data.
  43. * @since 2.7
  44. *
  45. * This is an optional method that overrides the App Version Flurry uses for reporting. Flurry will
  46. * use the CFBundleVersion in your info.plist file when this method is not invoked.
  47. *
  48. * @note There is a maximum of 605 versions allowed for a single app. \n
  49. * This method must be called prior to invoking #startSession:.
  50. *
  51. * @param version The custom version name.
  52. */
  53. + (void)setAppVersion:(NSString *)version;
  54. /*!
  55. * @brief Retrieves the Flurry Agent Build Version.
  56. * @since 2.7
  57. *
  58. * This is an optional method that retrieves the Flurry Agent Version the app is running under.
  59. * It is most often used if reporting an unexpected behavior of the SDK to <a href="mailto:iphonesupport@flurry.com">
  60. * Flurry Support</a>
  61. *
  62. * @note This method must be called prior to invoking #startSession:. \n
  63. * FAQ for the iPhone SDK is located at <a href="http://wiki.flurry.com/index.php?title=IPhone_FAQ">
  64. * Support Center - iPhone FAQ</a>.
  65. *
  66. * @see #setLogLevel: for information on how to view debugging information on your console.
  67. *
  68. * @return The agent version of the Flurry SDK.
  69. *
  70. */
  71. + (NSString *)getFlurryAgentVersion;
  72. /*!
  73. * @brief Displays an exception in the debug log if thrown during a Session.
  74. * @since 2.7
  75. *
  76. * This is an optional method that augments the debug logs with exceptions that occur during the session.
  77. * You must both capture exceptions to Flurry and set debug logging to enabled for this method to
  78. * display information to the console. The default setting for this method is @c NO.
  79. *
  80. * @note This method must be called prior to invoking #startSession:.
  81. *
  82. * @see #setLogLevel: for information on how to view debugging information on your console. \n
  83. * #logError:message:exception: for details on logging exceptions. \n
  84. * #logError:message:error: for details on logging errors.
  85. *
  86. * @param value @c YES to show errors in debug logs, @c NO to omit errors in debug logs.
  87. */
  88. + (void)setShowErrorInLogEnabled:(BOOL)value;
  89. /*!
  90. * @brief Generates debug logs to console.
  91. * @since 2.7
  92. *
  93. * This is an optional method that displays debug information related to the Flurry SDK.
  94. * display information to the console. The default setting for this method is @c NO
  95. * which sets the log level to @c FlurryLogLevelCriticalOnly.
  96. * When set to @c YES the debug log level is set to @c FlurryLogLevelDebug
  97. *
  98. * @note This method must be called prior to invoking #startSession:. If the method, setLogLevel is called later in the code, debug logging will be automatically enabled.
  99. *
  100. * @param value @c YES to show debug logs, @c NO to omit debug logs.
  101. *
  102. */
  103. + (void)setDebugLogEnabled:(BOOL)value;
  104. /*!
  105. * @brief Generates debug logs to console.
  106. * @since 4.2.2
  107. *
  108. * This is an optional method that displays debug information related to the Flurry SDK.
  109. * display information to the console. The default setting for this method is @c FlurryLogLevelCritycalOnly.
  110. *
  111. * @note Its good practice to call this method prior to invoking #startSession:. If debug logging is disabled earlier, this method will enable it.
  112. *
  113. * @param value Log level
  114. *
  115. */
  116. + (void)setLogLevel:(FlurryLogLevel)value;
  117. /*!
  118. * @brief Set the timeout for expiring a Flurry session.
  119. * @since 2.7
  120. *
  121. * This is an optional method that sets the time the app may be in the background before
  122. * starting a new session upon resume. The default value for the session timeout is 10
  123. * seconds in the background.
  124. *
  125. * @note This method must be called prior to invoking #startSession:.
  126. *
  127. * @param seconds The time in seconds to set the session timeout to.
  128. */
  129. + (void)setSessionContinueSeconds:(int)seconds;
  130. /*!
  131. * @brief Send data over a secure transport.
  132. * @since 3.0
  133. *
  134. * This is an optional method that sends data over an SSL connection when enabled. The
  135. * default value is @c NO.
  136. *
  137. * @note This method must be called prior to invoking #startSession:.
  138. *
  139. * @param value @c YES to send data over secure connection.
  140. */
  141. + (void)setSecureTransportEnabled:(BOOL)value;
  142. /*!
  143. * @brief Enable automatic collection of crash reports.
  144. * @since 4.1
  145. *
  146. * This is an optional method that collects crash reports when enabled. The
  147. * default value is @c NO.
  148. *
  149. * @note This method must be called prior to invoking #startSession:.
  150. *
  151. * @param value @c YES to enable collection of crash reports.
  152. */
  153. + (void)setCrashReportingEnabled:(BOOL)value;
  154. //@}
  155. /*!
  156. * @brief Start a Flurry session for the project denoted by @c apiKey.
  157. * @since 2.6
  158. *
  159. * This method serves as the entry point to Flurry Analytics collection. It must be
  160. * called in the scope of @c applicationDidFinishLaunching. The session will continue
  161. * for the period the app is in the foreground until your app is backgrounded for the
  162. * time specified in #setSessionContinueSeconds:. If the app is resumed in that period
  163. * the session will continue, otherwise a new session will begin.
  164. *
  165. * Crash reporting will not be enabled. See #setCrashReportingEnabled: for
  166. * more information.
  167. *
  168. * @note If testing on a simulator, please be sure to send App to background via home
  169. * button. Flurry depends on the iOS lifecycle to be complete for full reporting.
  170. *
  171. * @see #setSessionContinueSeconds: for details on setting a custom session timeout.
  172. *
  173. * @code
  174. * - (void)applicationDidFinishLaunching:(UIApplication *)application
  175. {
  176. // Optional Flurry startup methods
  177. [Flurry startSession:@"YOUR_API_KEY"];
  178. // ....
  179. }
  180. * @endcode
  181. *
  182. * @param apiKey The API key for this project.
  183. */
  184. + (void)startSession:(NSString *)apiKey;
  185. /*!
  186. * @brief Start a Flurry session for the project denoted by @c apiKey.
  187. * @since 4.0.8
  188. *
  189. * This method serves as the entry point to Flurry Analytics collection. It must be
  190. * called in the scope of @c applicationDidFinishLaunching passing in the launchOptions param.
  191. * The session will continue
  192. * for the period the app is in the foreground until your app is backgrounded for the
  193. * time specified in #setSessionContinueSeconds:. If the app is resumed in that period
  194. * the session will continue, otherwise a new session will begin.
  195. *
  196. * @note If testing on a simulator, please be sure to send App to background via home
  197. * button. Flurry depends on the iOS lifecycle to be complete for full reporting.
  198. *
  199. * @see #setSessionContinueSeconds: for details on setting a custom session timeout.
  200. *
  201. * @code
  202. * - (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  203. {
  204. // Optional Flurry startup methods
  205. [Flurry startSession:@"YOUR_API_KEY" withOptions:launchOptions];
  206. // ....
  207. }
  208. * @endcode
  209. *
  210. * @param apiKey The API key for this project.
  211. * @param options passed launchOptions from the applicatin's didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  212. */
  213. + (void) startSession:(NSString *)apiKey withOptions:(id)options;
  214. /*!
  215. * @brief Pauses a Flurry session left running in background.
  216. * @since 4.2.2
  217. *
  218. * This method should be used in case of #setBackgroundSessionEnabled: set to YES. It can be
  219. * called when application finished all background tasks (such as playing music) to pause session.
  220. *
  221. * @see #setBackgroundSessionEnabled: for details on setting a custom behaviour on resigning activity.
  222. *
  223. * @code
  224. * - (void)allBackgroundTasksFinished
  225. {
  226. // ....
  227. [Flurry pauseBackgroundSession];
  228. // ....
  229. }
  230. * @endcode
  231. *
  232. */
  233. + (void)pauseBackgroundSession;
  234. /*!
  235. * @brief Adds an SDK origin specified by @c originName and @c originVersion.
  236. * @since 5.0.0
  237. *
  238. * This method allows you to specify origin within your Flurry SDK wrapper. As a general rule
  239. * you should capture all the origin info related to your wrapper for Flurry SDK after every session start.
  240. *
  241. * @see #addOrigin:withVersion:withParameters: for details on reporting origin info with parameters. \n
  242. *
  243. * @code
  244. * - (void)interestingSDKWrapperLibraryfunction
  245. {
  246. // ... after calling startSession
  247. [Flurry addOrigin:@"Interesting_Wrapper" withVersion:@"1.0.0"];
  248. // more code ...
  249. }
  250. * @endcode
  251. *
  252. * @param originName Name of the origin.
  253. * @param originVersion Version string of the origin wrapper
  254. */
  255. + (void)addOrigin:(NSString *)originName withVersion:(NSString*)originVersion;
  256. /*!
  257. * @brief Adds a custom parameterized origin specified by @c originName with @c originVersion and @c parameters.
  258. * @since 5.0.0
  259. *
  260. * This method overrides #addOrigin to allow you to associate parameters with an origin attribute. Parameters
  261. * are valuable as they allow you to store characteristics of an origin.
  262. *
  263. * @note You should not pass private or confidential information about your origin info in a
  264. * custom origin. \n
  265. * A maximum of 9 parameter names may be associated with any origin. Sending
  266. * over 10 parameter names with a single origin will result in no parameters being logged
  267. * for that origin.
  268. *
  269. *
  270. * @code
  271. * - (void)userPurchasedSomethingCool
  272. {
  273. NSDictionary *params =
  274. [NSDictionary dictionaryWithObjectsAndKeys:@"Origin Info Item", // Parameter Value
  275. @"Origin Info Item Key", // Parameter Name
  276. nil];
  277. // ... after calling startSession
  278. [Flurry addOrigin:@"Interesting_Wrapper" withVersion:@"1.0.0"];
  279. // more code ...
  280. }
  281. * @endcode
  282. *
  283. * @param originName Name of the origin.
  284. * @param originVersion Version string of the origin wrapper
  285. * @param parameters An immutable copy of map containing Name-Value pairs of parameters.
  286. */
  287. + (void)addOrigin:(NSString *)originName withVersion:(NSString*)originVersion withParameters:(NSDictionary *)parameters;
  288. /** @name Event and Error Logging
  289. * Methods for reporting custom events and errors during the session.
  290. */
  291. //@{
  292. /*!
  293. * @brief Records a custom event specified by @c eventName.
  294. * @since 2.8.4
  295. *
  296. * This method allows you to specify custom events within your app. As a general rule
  297. * you should capture events related to user navigation within your app, any action
  298. * around monetization, and other events as they are applicable to tracking progress
  299. * towards your business goals.
  300. *
  301. * @note You should not pass private or confidential information about your users in a
  302. * custom event. \n
  303. * Where applicable, you should make a concerted effort to use timed events with
  304. * parameters (#logEvent:withParameters:timed:) or events with parameters
  305. * (#logEvent:withParameters:). This provides valuable information around the time the user
  306. * spends within an action (e.g. - time spent on a level or viewing a page) or characteristics
  307. * of an action (e.g. - Buy Event that has a Parameter of Widget with Value Golden Sword).
  308. *
  309. * @see #logEvent:withParameters: for details on storing events with parameters. \n
  310. * #logEvent:timed: for details on storing timed events. \n
  311. * #logEvent:withParameters:timed: for details on storing timed events with parameters. \n
  312. * #endTimedEvent:withParameters: for details on stopping a timed event and (optionally) updating
  313. * parameters.
  314. *
  315. * @code
  316. * - (void)interestingAppAction
  317. {
  318. [Flurry logEvent:@"Interesting_Action"];
  319. // Perform interesting action
  320. }
  321. * @endcode
  322. *
  323. * @param eventName Name of the event. For maximum effectiveness, we recommend using a naming scheme
  324. * that can be easily understood by non-technical people in your business domain.
  325. */
  326. + (void)logEvent:(NSString *)eventName;
  327. /*!
  328. * @brief Records a custom parameterized event specified by @c eventName with @c parameters.
  329. * @since 2.8.4
  330. *
  331. * This method overrides #logEvent to allow you to associate parameters with an event. Parameters
  332. * are extremely valuable as they allow you to store characteristics of an action. For example,
  333. * if a user purchased an item it may be helpful to know what level that user was on.
  334. * By setting this parameter you will be able to view a distribution of levels for the purcahsed
  335. * event on the <a href="http://dev.flurry.com">Flurrly Dev Portal</a>.
  336. *
  337. * @note You should not pass private or confidential information about your users in a
  338. * custom event. \n
  339. * A maximum of 10 parameter names may be associated with any event. Sending
  340. * over 10 parameter names with a single event will result in no parameters being logged
  341. * for that event. You may specify an infinite number of Parameter values. For example,
  342. * a Search Box would have 1 parameter name (e.g. - Search Box) and many values, which would
  343. * allow you to see what values users look for the most in your app. \n
  344. * Where applicable, you should make a concerted effort to use timed events with
  345. * parameters (#logEvent:withParameters:timed:). This provides valuable information
  346. * around the time the user spends within an action (e.g. - time spent on a level or
  347. * viewing a page).
  348. *
  349. * @see #logEvent:withParameters:timed: for details on storing timed events with parameters. \n
  350. * #endTimedEvent:withParameters: for details on stopping a timed event and (optionally) updating
  351. * parameters.
  352. *
  353. * @code
  354. * - (void)userPurchasedSomethingCool
  355. {
  356. NSDictionary *params =
  357. [NSDictionary dictionaryWithObjectsAndKeys:@"Cool Item", // Parameter Value
  358. @"Item Purchased", // Parameter Name
  359. nil];
  360. [Flurry logEvent:@"Something Cool Purchased" withParameters:params];
  361. // Give user cool item
  362. }
  363. * @endcode
  364. *
  365. * @param eventName Name of the event. For maximum effectiveness, we recommend using a naming scheme
  366. * that can be easily understood by non-technical people in your business domain.
  367. * @param parameters An immutable copy of map containing Name-Value pairs of parameters.
  368. */
  369. + (void)logEvent:(NSString *)eventName withParameters:(NSDictionary *)parameters;
  370. /*!
  371. * @brief Records an app exception. Commonly used to catch unhandled exceptions.
  372. * @since 2.7
  373. *
  374. * This method captures an exception for reporting to Flurry. We recommend adding an uncaught
  375. * exception listener to capture any exceptions that occur during usage that is not
  376. * anticipated by your app.
  377. *
  378. * @see #logError:message:error: for details on capturing errors.
  379. *
  380. * @code
  381. * - (void) uncaughtExceptionHandler(NSException *exception)
  382. {
  383. [Flurry logError:@"Uncaught" message:@"Crash!" exception:exception];
  384. }
  385. - (void)applicationDidFinishLaunching:(UIApplication *)application
  386. {
  387. NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
  388. [Flurry startSession:@"YOUR_API_KEY"];
  389. // ....
  390. }
  391. * @endcode
  392. *
  393. * @param errorID Name of the error.
  394. * @param message The message to associate with the error.
  395. * @param exception The exception object to report.
  396. */
  397. + (void)logError:(NSString *)errorID message:(NSString *)message exception:(NSException *)exception;
  398. /*!
  399. * @brief Records an app error.
  400. * @since 2.7
  401. *
  402. * This method captures an error for reporting to Flurry.
  403. *
  404. * @see #logError:message:exception: for details on capturing exceptions.
  405. *
  406. * @code
  407. * - (void) webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
  408. {
  409. [Flurry logError:@"WebView No Load" message:[error localizedDescription] error:error];
  410. }
  411. * @endcode
  412. *
  413. * @param errorID Name of the error.
  414. * @param message The message to associate with the error.
  415. * @param error The error object to report.
  416. */
  417. + (void)logError:(NSString *)errorID message:(NSString *)message error:(NSError *)error;
  418. /*!
  419. * @brief Records a timed event specified by @c eventName.
  420. * @since 2.8.4
  421. *
  422. * This method overrides #logEvent to allow you to capture the length of an event. This can
  423. * be extremely valuable to understand the level of engagement with a particular action. For
  424. * example, you can capture how long a user spends on a level or reading an article.
  425. *
  426. * @note You should not pass private or confidential information about your users in a
  427. * custom event. \n
  428. * Where applicable, you should make a concerted effort to use parameters with your timed
  429. * events (#logEvent:withParameters:timed:). This provides valuable information
  430. * around the characteristics of an action (e.g. - Buy Event that has a Parameter of Widget with
  431. * Value Golden Sword).
  432. *
  433. * @see #logEvent:withParameters:timed: for details on storing timed events with parameters. \n
  434. * #endTimedEvent:withParameters: for details on stopping a timed event and (optionally) updating
  435. * parameters.
  436. *
  437. * @code
  438. * - (void)startLevel
  439. {
  440. [Flurry logEvent:@"Level Played" timed:YES];
  441. // Start user on level
  442. }
  443. - (void)endLevel
  444. {
  445. [Flurry endTimedEvent:@"Level Played" withParameters:nil];
  446. // User done with level
  447. }
  448. * @endcode
  449. *
  450. * @param eventName Name of the event. For maximum effectiveness, we recommend using a naming scheme
  451. * that can be easily understood by non-technical people in your business domain.
  452. * @param timed Specifies the event will be timed.
  453. */
  454. + (void)logEvent:(NSString *)eventName timed:(BOOL)timed;
  455. /*!
  456. * @brief Records a custom parameterized timed event specified by @c eventName with @c parameters.
  457. * @since 2.8.4
  458. *
  459. * This method overrides #logEvent to allow you to capture the length of an event with parameters.
  460. * This can be extremely valuable to understand the level of engagement with a particular action
  461. * and the characteristics associated with that action. For example, you can capture how long a user
  462. * spends on a level or reading an article. Parameters can be used to capture, for example, the
  463. * author of an article or if something was purchased while on the level.
  464. *
  465. * @note You should not pass private or confidential information about your users in a
  466. * custom event.
  467. *
  468. * @see #endTimedEvent:withParameters: for details on stopping a timed event and (optionally) updating
  469. * parameters.
  470. *
  471. * @code
  472. * - (void)startLevel
  473. {
  474. NSDictionary *params =
  475. [NSDictionary dictionaryWithObjectsAndKeys:@"100", // Parameter Value
  476. @"Current Points", // Parameter Name
  477. nil];
  478. [Flurry logEvent:@"Level Played" withParameters:params timed:YES];
  479. // Start user on level
  480. }
  481. - (void)endLevel
  482. {
  483. // User gained additional 100 points in Level
  484. NSDictionary *params =
  485. [NSDictionary dictionaryWithObjectsAndKeys:@"200", // Parameter Value
  486. @"Current Points", // Parameter Name
  487. nil];
  488. [Flurry endTimedEvent:@"Level Played" withParameters:params];
  489. // User done with level
  490. }
  491. * @endcode
  492. *
  493. * @param eventName Name of the event. For maximum effectiveness, we recommend using a naming scheme
  494. * that can be easily understood by non-technical people in your business domain.
  495. * @param parameters An immutable copy of map containing Name-Value pairs of parameters.
  496. * @param timed Specifies the event will be timed.
  497. */
  498. + (void)logEvent:(NSString *)eventName withParameters:(NSDictionary *)parameters timed:(BOOL)timed;
  499. /*!
  500. * @brief Ends a timed event specified by @c eventName and optionally updates parameters with @c parameters.
  501. * @since 2.8.4
  502. *
  503. * This method ends an existing timed event. If parameters are provided, this will overwrite existing
  504. * parameters with the same name or create new parameters if the name does not exist in the parameter
  505. * map set by #logEvent:withParameters:timed:.
  506. *
  507. * @note You should not pass private or confidential information about your users in a
  508. * custom event. \n
  509. * If the app is backgrounded prior to ending a timed event, the Flurry SDK will automatically
  510. * end the timer on the event. \n
  511. * #endTimedEvent:withParameters: is ignored if called on a previously
  512. * terminated event.
  513. *
  514. * @see #logEvent:withParameters:timed: for details on starting a timed event with parameters.
  515. *
  516. * @code
  517. * - (void)startLevel
  518. {
  519. NSDictionary *params =
  520. [NSDictionary dictionaryWithObjectsAndKeys:@"100", // Parameter Value
  521. @"Current Points", // Parameter Name
  522. nil];
  523. [Flurry logEvent:@"Level Played" withParameters:params timed:YES];
  524. // Start user on level
  525. }
  526. - (void)endLevel
  527. {
  528. // User gained additional 100 points in Level
  529. NSDictionary *params =
  530. [NSDictionary dictionaryWithObjectsAndKeys:@"200", // Parameter Value
  531. @"Current Points", // Parameter Name
  532. nil];
  533. [Flurry endTimedEvent:@"Level Played" withParameters:params];
  534. // User done with level
  535. }
  536. * @endcode
  537. *
  538. * @param eventName Name of the event. For maximum effectiveness, we recommend using a naming scheme
  539. * that can be easily understood by non-technical people in your business domain.
  540. * @param parameters An immutable copy of map containing Name-Value pairs of parameters.
  541. */
  542. + (void)endTimedEvent:(NSString *)eventName withParameters:(NSDictionary *)parameters; // non-nil parameters will update the parameters
  543. //@}
  544. /** @name Page View Methods
  545. * Count page views.
  546. */
  547. //@{
  548. /*!
  549. * @deprecated
  550. * @brief see +(void)logAllPageViewsForTarget:(id)target; for details
  551. * @since 2.7
  552. * This method does the same as +(void)logAllPageViewsForTarget:(id)target method and is left for backward compatibility
  553. */
  554. + (void)logAllPageViews:(id)target __attribute__ ((deprecated));
  555. /*!
  556. * @brief Automatically track page views on a @c UINavigationController or @c UITabBarController.
  557. * @since 4.3
  558. *
  559. * This method increments the page view count for a session based on traversing a UINavigationController
  560. * or UITabBarController. The page view count is only a counter for the number of transitions in your
  561. * app. It does not associate a name with the page count. To associate a name with a count of occurences
  562. * see #logEvent:.
  563. *
  564. * @note If you need to release passed target, you should call counterpart method + (void)stopLogPageViewsForTarget:(id)target before;
  565. *
  566. * @see #logPageView for details on explictly incrementing page view count.
  567. *
  568. * @code
  569. * -(void) trackViewsFromTabBar:(UITabBarController*) tabBar
  570. {
  571. [Flurry logAllPageViewsForTarget:tabBar];
  572. }
  573. * @endcode
  574. *
  575. * @param target The navigation or tab bar controller.
  576. */
  577. + (void)logAllPageViewsForTarget:(id)target;
  578. /*!
  579. * @brief Stops logging page views on previously observed with logAllPageViewsForTarget: @c UINavigationController or @c UITabBarController.
  580. * @since 4.3
  581. *
  582. * Call this method before instance of @c UINavigationController or @c UITabBarController observed with logAllPageViewsForTarget: is released.
  583. *
  584. * @code
  585. * -(void) dealloc
  586. {
  587. [Flurry stopLogPageViewsForTarget:_tabBarController];
  588. [_tabBarController release];
  589. [super dealloc];
  590. }
  591. * @endcode
  592. *
  593. * @param target The navigation or tab bar controller.
  594. */
  595. + (void)stopLogPageViewsForTarget:(id)target;
  596. /*!
  597. * @brief Explicitly track a page view during a session.
  598. * @since 2.7
  599. *
  600. * This method increments the page view count for a session when invoked. It does not associate a name
  601. * with the page count. To associate a name with a count of occurences see #logEvent:.
  602. *
  603. * @see #logAllPageViews for details on automatically incrementing page view count based on user
  604. * traversing navigation or tab bar controller.
  605. *
  606. * @code
  607. * -(void) trackView
  608. {
  609. [Flurry logPageView];
  610. }
  611. * @endcode
  612. *
  613. */
  614. + (void)logPageView;
  615. //@}
  616. /** @name User Info
  617. * Methods to set user information.
  618. */
  619. //@{
  620. /*!
  621. * @brief Assign a unique id for a user in your app.
  622. * @since 2.7
  623. *
  624. * @note Please be sure not to use this method to pass any private or confidential information
  625. * about the user.
  626. *
  627. * @param userID The app id for a user.
  628. */
  629. + (void)setUserID:(NSString *)userID;
  630. /*!
  631. * @brief Set your user's age in years.
  632. * @since 2.7
  633. *
  634. * Use this method to capture the age of your user. Only use this method if you collect this
  635. * information explictly from your user (i.e. - there is no need to set a default value).
  636. *
  637. * @note The age is aggregated across all users of your app and not available on a per user
  638. * basis.
  639. *
  640. * @param age Reported age of user.
  641. *
  642. */
  643. + (void)setAge:(int)age;
  644. /*!
  645. * @brief Set your user's gender.
  646. * @since 2.7
  647. *
  648. * Use this method to capture the gender of your user. Only use this method if you collect this
  649. * information explictly from your user (i.e. - there is no need to set a default value). Allowable
  650. * values are @c @"m" or @c @"f"
  651. *
  652. * @note The gender is aggregated across all users of your app and not available on a per user
  653. * basis.
  654. *
  655. * @param gender Reported gender of user.
  656. *
  657. */
  658. + (void)setGender:(NSString *)gender; // user's gender m or f
  659. //@}
  660. /** @name Location Reporting
  661. * Methods for setting location information.
  662. */
  663. //@{
  664. /*!
  665. * @brief Set the location of the session.
  666. * @since 2.7
  667. *
  668. * Use information from the CLLocationManager to specify the location of the session. Flurry does not
  669. * automatically track this information or include the CLLocation framework.
  670. *
  671. * @note Only the last location entered is captured per session. \n
  672. * Regardless of accuracy specified, the Flurry SDK will only report location at city level or higher. \n
  673. * Location is aggregated across all users of your app and not available on a per user basis. \n
  674. * This information should only be captured if it is germaine to the use of your app.
  675. *
  676. * @code
  677. CLLocationManager *locationManager = [[CLLocationManager alloc] init];
  678. [locationManager startUpdatingLocation];
  679. * @endcode
  680. *
  681. * After starting the location manager, you can set the location with Flurry. You can implement
  682. * CLLocationManagerDelegate to be aware of when the location is updated. Below is an example
  683. * of how to use this method, after you have recieved a location update from the locationManager.
  684. *
  685. * @code
  686. CLLocation *location = locationManager.location;
  687. [Flurry setLatitude:location.coordinate.latitude
  688. longitude:location.coordinate.longitude
  689. horizontalAccuracy:location.horizontalAccuracy
  690. verticalAccuracy:location.verticalAccuracy];
  691. * @endcode
  692. * @param latitude The latitude.
  693. * @param longitude The longitude.
  694. * @param horizontalAccuracy The radius of uncertainty for the location in meters.
  695. * @param verticalAccuracy The accuracy of the altitude value in meters.
  696. *
  697. */
  698. + (void)setLatitude:(double)latitude longitude:(double)longitude horizontalAccuracy:(float)horizontalAccuracy verticalAccuracy:(float)verticalAccuracy;
  699. //@}
  700. /** @name Session Reporting Calls
  701. * Optional methods that can be called at any point to control session reporting.
  702. */
  703. //@{
  704. /*!
  705. * @brief Set session to report when app closes.
  706. * @since 2.7
  707. *
  708. * Use this method report session data when the app is closed. The default value is @c YES.
  709. *
  710. * @note This method is rarely invoked in iOS >= 3.2 due to the updated iOS lifecycle.
  711. *
  712. * @see #setSessionReportsOnPauseEnabled:
  713. *
  714. * @param sendSessionReportsOnClose YES to send on close, NO to omit reporting on close.
  715. *
  716. */
  717. + (void)setSessionReportsOnCloseEnabled:(BOOL)sendSessionReportsOnClose;
  718. /*!
  719. * @brief Set session to report when app is sent to the background.
  720. * @since 2.7
  721. *
  722. * Use this method report session data when the app is paused. The default value is @c YES.
  723. *
  724. * @param setSessionReportsOnPauseEnabled YES to send on pause, NO to omit reporting on pause.
  725. *
  726. */
  727. + (void)setSessionReportsOnPauseEnabled:(BOOL)setSessionReportsOnPauseEnabled;
  728. /*!
  729. * @brief Set session to support background execution.
  730. * @since 4.2.2
  731. *
  732. * Use this method to enable reporting of errors and events when application is
  733. * running in backgorund (such applications have UIBackgroundModes in Info.plist).
  734. * You should call #pauseBackgroundSession when appropriate in background mode to
  735. * pause the session (for example when played song completed in background)
  736. *
  737. * Default value is @c NO
  738. *
  739. * @see #pauseBackgroundSession for details
  740. *
  741. * @param setBackgroundSessionEnabled YES to enbale background support and
  742. * continue log events and errors for running session.
  743. */
  744. + (void)setBackgroundSessionEnabled:(BOOL)setBackgroundSessionEnabled;
  745. /*!
  746. * @brief Enable custom event logging.
  747. * @since 2.7
  748. *
  749. * Use this method to allow the capture of custom events. The default value is @c YES.
  750. *
  751. * @param value YES to enable event logging, NO to stop custom logging.
  752. *
  753. */
  754. + (void)setEventLoggingEnabled:(BOOL)value;
  755. //@}
  756. @end