5 // Copyright (c) 2015 Crashlytics, Inc. All rights reserved.
8 #import <Foundation/Foundation.h>
9 #import "ANSCompatibility.h"
11 NS_ASSUME_NONNULL_BEGIN
14 * This class exposes the Answers Events API, allowing you to track key
15 * user user actions and metrics in your app.
17 @interface Answers : NSObject
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.
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.
27 + (void)logSignUpWithMethod:(nullable NSString *)signUpMethodOrNil
28 success:(nullable NSNumber *)signUpSucceededOrNil
29 customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
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.
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.
39 + (void)logLoginWithMethod:(nullable NSString *)loginMethodOrNil
40 success:(nullable NSNumber *)loginSucceededOrNil
41 customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
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.
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.
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;
60 * Log an Invite Event to track how users are inviting other users into
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.
66 + (void)logInviteWithMethod:(nullable NSString *)inviteMethodOrNil
67 customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
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.
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.
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;
90 * Log a Level Start Event to track where users are in your game.
92 * @param levelNameOrNil The level name
93 * @param customAttributesOrNil A dictionary of custom attributes to associate with this level start event.
95 + (void)logLevelStart:(nullable NSString *)levelNameOrNil
96 customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
99 * Log a Level End event to track how users are completing levels in your game.
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.
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;
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.
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.
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;
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.
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.
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;
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.
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.
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;
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.
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.
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;
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.
179 * @param queryOrNil The user's query.
180 * @param customAttributesOrNil A dictionary of custom attributes to associate with this event.
182 + (void)logSearchWithQuery:(nullable NSString *)queryOrNil
183 customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
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.
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.
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
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
205 + (void)logCustomEventWithName:(NSString *)eventName
206 customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
210 NS_ASSUME_NONNULL_END