|
| 1 | +// |
| 2 | +// Answers.h |
| 3 | +// Crashlytics |
| 4 | +// |
| 5 | +// Copyright (c) 2015 Crashlytics, Inc. All rights reserved. |
| 6 | +// |
| 7 | + |
| 8 | +#import <Foundation/Foundation.h> |
| 9 | +#import "ANSCompatibility.h" |
| 10 | + |
| 11 | +NS_ASSUME_NONNULL_BEGIN |
| 12 | + |
| 13 | +/** |
| 14 | + * This class exposes the Answers Events API, allowing you to track key |
| 15 | + * user user actions and metrics in your app. |
| 16 | + */ |
| 17 | +@interface Answers : NSObject |
| 18 | + |
| 19 | +/** |
| 20 | + * Log a Sign Up event to see users signing up for your app in real-time, understand how |
| 21 | + * many users are signing up with different methods and their success rate signing up. |
| 22 | + * |
| 23 | + * @param signUpMethodOrNil The method by which a user logged in, e.g. Twitter or Digits. |
| 24 | + * @param signUpSucceededOrNil The ultimate success or failure of the login |
| 25 | + * @param customAttributesOrNil A dictionary of custom attributes to associate with this event. |
| 26 | + */ |
| 27 | ++ (void)logSignUpWithMethod:(nullable NSString *)signUpMethodOrNil |
| 28 | + success:(nullable NSNumber *)signUpSucceededOrNil |
| 29 | + customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil; |
| 30 | + |
| 31 | +/** |
| 32 | + * Log an Log In event to see users logging into your app in real-time, understand how many |
| 33 | + * users are logging in with different methods and their success rate logging into your app. |
| 34 | + * |
| 35 | + * @param loginMethodOrNil The method by which a user logged in, e.g. email, Twitter or Digits. |
| 36 | + * @param loginSucceededOrNil The ultimate success or failure of the login |
| 37 | + * @param customAttributesOrNil A dictionary of custom attributes to associate with this event. |
| 38 | + */ |
| 39 | ++ (void)logLoginWithMethod:(nullable NSString *)loginMethodOrNil |
| 40 | + success:(nullable NSNumber *)loginSucceededOrNil |
| 41 | + customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil; |
| 42 | + |
| 43 | +/** |
| 44 | + * Log a Share event to see users sharing from your app in real-time, letting you |
| 45 | + * understand what content they're sharing from the type or genre down to the specific id. |
| 46 | + * |
| 47 | + * @param shareMethodOrNil The method by which a user shared, e.g. email, Twitter, SMS. |
| 48 | + * @param contentNameOrNil The human readable name for this piece of content. |
| 49 | + * @param contentTypeOrNil The type of content shared. |
| 50 | + * @param contentIdOrNil The unique identifier for this piece of content. Useful for finding the top shared item. |
| 51 | + * @param customAttributesOrNil A dictionary of custom attributes to associate with this event. |
| 52 | + */ |
| 53 | ++ (void)logShareWithMethod:(nullable NSString *)shareMethodOrNil |
| 54 | + contentName:(nullable NSString *)contentNameOrNil |
| 55 | + contentType:(nullable NSString *)contentTypeOrNil |
| 56 | + contentId:(nullable NSString *)contentIdOrNil |
| 57 | + customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil; |
| 58 | + |
| 59 | +/** |
| 60 | + * Log an Invite Event to track how users are inviting other users into |
| 61 | + * your application. |
| 62 | + * |
| 63 | + * @param inviteMethodOrNil The method of invitation, e.g. GameCenter, Twitter, email. |
| 64 | + * @param customAttributesOrNil A dictionary of custom attributes to associate with this event. |
| 65 | + */ |
| 66 | ++ (void)logInviteWithMethod:(nullable NSString *)inviteMethodOrNil |
| 67 | + customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil; |
| 68 | + |
| 69 | +/** |
| 70 | + * Log a Purchase event to see your revenue in real-time, understand how many users are making purchases, see which |
| 71 | + * items are most popular, and track plenty of other important purchase-related metrics. |
| 72 | + * |
| 73 | + * @param itemPriceOrNil The purchased item's price. |
| 74 | + * @param currencyOrNil The ISO4217 currency code. Example: USD |
| 75 | + * @param purchaseSucceededOrNil Was the purchase successful or unsuccessful |
| 76 | + * @param itemNameOrNil The human-readable form of the item's name. Example: |
| 77 | + * @param itemTypeOrNil The type, or genre of the item. Example: Song |
| 78 | + * @param itemIdOrNil The machine-readable, unique item identifier Example: SKU |
| 79 | + * @param customAttributesOrNil A dictionary of custom attributes to associate with this purchase. |
| 80 | + */ |
| 81 | ++ (void)logPurchaseWithPrice:(nullable NSDecimalNumber *)itemPriceOrNil |
| 82 | + currency:(nullable NSString *)currencyOrNil |
| 83 | + success:(nullable NSNumber *)purchaseSucceededOrNil |
| 84 | + itemName:(nullable NSString *)itemNameOrNil |
| 85 | + itemType:(nullable NSString *)itemTypeOrNil |
| 86 | + itemId:(nullable NSString *)itemIdOrNil |
| 87 | + customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil; |
| 88 | + |
| 89 | +/** |
| 90 | + * Log a Level Start Event to track where users are in your game. |
| 91 | + * |
| 92 | + * @param levelNameOrNil The level name |
| 93 | + * @param customAttributesOrNil A dictionary of custom attributes to associate with this level start event. |
| 94 | + */ |
| 95 | ++ (void)logLevelStart:(nullable NSString *)levelNameOrNil |
| 96 | + customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil; |
| 97 | + |
| 98 | +/** |
| 99 | + * Log a Level End event to track how users are completing levels in your game. |
| 100 | + * |
| 101 | + * @param levelNameOrNil The name of the level completed, E.G. "1" or "Training" |
| 102 | + * @param scoreOrNil The score the user completed the level with. |
| 103 | + * @param levelCompletedSuccesfullyOrNil A boolean representing whether or not the level was completed successfully. |
| 104 | + * @param customAttributesOrNil A dictionary of custom attributes to associate with this event. |
| 105 | + */ |
| 106 | ++ (void)logLevelEnd:(nullable NSString *)levelNameOrNil |
| 107 | + score:(nullable NSNumber *)scoreOrNil |
| 108 | + success:(nullable NSNumber *)levelCompletedSuccesfullyOrNil |
| 109 | + customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil; |
| 110 | + |
| 111 | +/** |
| 112 | + * Log an Add to Cart event to see users adding items to a shopping cart in real-time, understand how |
| 113 | + * many users start the purchase flow, see which items are most popular, and track plenty of other important |
| 114 | + * purchase-related metrics. |
| 115 | + * |
| 116 | + * @param itemPriceOrNil The purchased item's price. |
| 117 | + * @param currencyOrNil The ISO4217 currency code. Example: USD |
| 118 | + * @param itemNameOrNil The human-readable form of the item's name. Example: |
| 119 | + * @param itemTypeOrNil The type, or genre of the item. Example: Song |
| 120 | + * @param itemIdOrNil The machine-readable, unique item identifier Example: SKU |
| 121 | + * @param customAttributesOrNil A dictionary of custom attributes to associate with this event. |
| 122 | + */ |
| 123 | ++ (void)logAddToCartWithPrice:(nullable NSDecimalNumber *)itemPriceOrNil |
| 124 | + currency:(nullable NSString *)currencyOrNil |
| 125 | + itemName:(nullable NSString *)itemNameOrNil |
| 126 | + itemType:(nullable NSString *)itemTypeOrNil |
| 127 | + itemId:(nullable NSString *)itemIdOrNil |
| 128 | + customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil; |
| 129 | + |
| 130 | +/** |
| 131 | + * Log a Start Checkout event to see users moving through the purchase funnel in real-time, understand how many |
| 132 | + * users are doing this and how much they're spending per checkout, and see how it related to other important |
| 133 | + * purchase-related metrics. |
| 134 | + * |
| 135 | + * @param totalPriceOrNil The total price of the cart. |
| 136 | + * @param currencyOrNil The ISO4217 currency code. Example: USD |
| 137 | + * @param itemCountOrNil The number of items in the cart. |
| 138 | + * @param customAttributesOrNil A dictionary of custom attributes to associate with this event. |
| 139 | + */ |
| 140 | ++ (void)logStartCheckoutWithPrice:(nullable NSDecimalNumber *)totalPriceOrNil |
| 141 | + currency:(nullable NSString *)currencyOrNil |
| 142 | + itemCount:(nullable NSNumber *)itemCountOrNil |
| 143 | + customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil; |
| 144 | + |
| 145 | +/** |
| 146 | + * Log a Rating event to see users rating content within your app in real-time and understand what |
| 147 | + * content is most engaging, from the type or genre down to the specific id. |
| 148 | + * |
| 149 | + * @param ratingOrNil The integer rating given by the user. |
| 150 | + * @param contentNameOrNil The human readable name for this piece of content. |
| 151 | + * @param contentTypeOrNil The type of content shared. |
| 152 | + * @param contentIdOrNil The unique identifier for this piece of content. Useful for finding the top shared item. |
| 153 | + * @param customAttributesOrNil A dictionary of custom attributes to associate with this event. |
| 154 | + */ |
| 155 | ++ (void)logRating:(nullable NSNumber *)ratingOrNil |
| 156 | + contentName:(nullable NSString *)contentNameOrNil |
| 157 | + contentType:(nullable NSString *)contentTypeOrNil |
| 158 | + contentId:(nullable NSString *)contentIdOrNil |
| 159 | + customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil; |
| 160 | + |
| 161 | +/** |
| 162 | + * Log a Content View event to see users viewing content within your app in real-time and |
| 163 | + * understand what content is most engaging, from the type or genre down to the specific id. |
| 164 | + * |
| 165 | + * @param contentNameOrNil The human readable name for this piece of content. |
| 166 | + * @param contentTypeOrNil The type of content shared. |
| 167 | + * @param contentIdOrNil The unique identifier for this piece of content. Useful for finding the top shared item. |
| 168 | + * @param customAttributesOrNil A dictionary of custom attributes to associate with this event. |
| 169 | + */ |
| 170 | ++ (void)logContentViewWithName:(nullable NSString *)contentNameOrNil |
| 171 | + contentType:(nullable NSString *)contentTypeOrNil |
| 172 | + contentId:(nullable NSString *)contentIdOrNil |
| 173 | + customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil; |
| 174 | + |
| 175 | +/** |
| 176 | + * Log a Search event allows you to see users searching within your app in real-time and understand |
| 177 | + * exactly what they're searching for. |
| 178 | + * |
| 179 | + * @param queryOrNil The user's query. |
| 180 | + * @param customAttributesOrNil A dictionary of custom attributes to associate with this event. |
| 181 | + */ |
| 182 | ++ (void)logSearchWithQuery:(nullable NSString *)queryOrNil |
| 183 | + customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil; |
| 184 | + |
| 185 | +/** |
| 186 | + * Log a Custom Event to see user actions that are uniquely important for your app in real-time, to see how often |
| 187 | + * they're performing these actions with breakdowns by different categories you add. Use a human-readable name for |
| 188 | + * the name of the event, since this is how the event will appear in Answers. |
| 189 | + * |
| 190 | + * @param eventName The human-readable name for the event. |
| 191 | + * @param customAttributesOrNil A dictionary of custom attributes to associate with this event. Attribute keys |
| 192 | + * must be <code>NSString</code> and values must be <code>NSNumber</code> or <code>NSString</code>. |
| 193 | + * @discussion How we treat <code>NSNumbers</code>: |
| 194 | + * We will provide information about the distribution of values over time. |
| 195 | + * |
| 196 | + * How we treat <code>NSStrings</code>: |
| 197 | + * NSStrings are used as categorical data, allowing comparison across different category values. |
| 198 | + * Strings are limited to a maximum length of 100 characters, attributes over this length will be |
| 199 | + * truncated. |
| 200 | + * |
| 201 | + * When tracking the Tweet views to better understand user engagement, sending the tweet's length |
| 202 | + * and the type of media present in the tweet allows you to track how tweet length and the type of media influence |
| 203 | + * engagement. |
| 204 | + */ |
| 205 | ++ (void)logCustomEventWithName:(NSString *)eventName |
| 206 | + customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil; |
| 207 | + |
| 208 | +@end |
| 209 | + |
| 210 | +NS_ASSUME_NONNULL_END |
0 commit comments