PFAnalytics
Objective-C
@interface PFAnalytics : NSObject
Swift
class PFAnalytics : NSObject
PFAnalytics provides an interface to Parse’s logging and analytics backend.
Methods will return immediately and cache the request (+ timestamp) to be handled “eventually.” That is, the request will be sent immediately if possible or the next time a network connection is available.
-
Tracks this application being launched. If this happened as the result of the user opening a push notification, this method sends along information to correlate this open with that push.
Pass in
nilto track a standard “application opened” event.Declaration
Objective-C
+ (id)trackAppOpenedWithLaunchOptions:(nullable NSDictionary *)launchOptions;Swift
class func trackAppOpened(launchOptions: [AnyHashable : Any]? = nil) -> Any!Parameters
launchOptionsThe
NSDictionaryindicating the reason the application was launched, if any. This value can be found as a parameter to variousUIApplicationDelegatemethods, and can be empty ornil.Return Value
Returns the task encapsulating the work being done.
-
Tracks this application being launched. If this happened as the result of the user opening a push notification, this method sends along information to correlate this open with that push.
Pass in
nilto track a standard “application opened” event.Declaration
Objective-C
+ (void) trackAppOpenedWithLaunchOptionsInBackground: (nullable NSDictionary *)launchOptions block:(nullable PFBooleanResultBlock) block;Swift
class func trackAppOpenedWithLaunchOptions(inBackground launchOptions: [AnyHashable : Any]?, block: PFBooleanResultBlock? = nil)Parameters
launchOptionsThe dictionary indicating the reason the application was launched, if any. This value can be found as a parameter to various
UIApplicationDelegatemethods, and can be empty ornil.blockThe block to execute on server response. It should have the following argument signature:
^(BOOL succeeded, NSError *error) -
Tracks this application being launched. If this happened as the result of the user opening a push notification, this method sends along information to correlate this open with that push.
Declaration
Objective-C
+ (id)trackAppOpenedWithRemoteNotificationPayload: (nullable NSDictionary *)userInfo;Swift
class func trackAppOpened(withRemoteNotificationPayload userInfo: [AnyHashable : Any]?) -> Any!Parameters
userInfoThe Remote Notification payload, if any. This value can be found either under
UIApplicationLaunchOptionsRemoteNotificationKeyonlaunchOptions, or as a parameter toapplication:didReceiveRemoteNotification:. This can be empty ornil.Return Value
Returns the task encapsulating the work being done.
-
Tracks this application being launched. If this happened as the result of the user opening a push notification, this method sends along information to correlate this open with that push.
Declaration
Objective-C
+ (void) trackAppOpenedWithRemoteNotificationPayloadInBackground: (nullable NSDictionary *)userInfo block: (nullable PFBooleanResultBlock) block;Swift
class func trackAppOpenedWithRemoteNotificationPayload(inBackground userInfo: [AnyHashable : Any]?, block: PFBooleanResultBlock? = nil)Parameters
userInfoThe Remote Notification payload, if any. This value can be found either under
UIApplicationLaunchOptionsRemoteNotificationKeyonlaunchOptions, or as a parameter toapplication:didReceiveRemoteNotification:. This can be empty ornil.blockThe block to execute on server response. It should have the following argument signature:
^(BOOL succeeded, NSError *error)
-
Tracks the occurrence of a custom event.
Parse will store a data point at the time of invocation with the given event name.
Declaration
Objective-C
+ (id)trackEvent:(nonnull NSString *)name;Swift
class func trackEvent(_ name: String) -> Any!Parameters
nameThe name of the custom event to report to Parse as having happened.
Return Value
Returns the task encapsulating the work being done.
-
Tracks the occurrence of a custom event. Parse will store a data point at the time of invocation with the given event name. The event will be sent at some unspecified time in the future, even if Parse is currently inaccessible.
Declaration
Objective-C
+ (void)trackEventInBackground:(nonnull NSString *)name block:(nullable PFBooleanResultBlock)block;Swift
class func trackEvent(inBackground name: String, block: PFBooleanResultBlock? = nil)Parameters
nameThe name of the custom event to report to Parse as having happened.
blockThe block to execute on server response. It should have the following argument signature:
^(BOOL succeeded, NSError *error) -
Tracks the occurrence of a custom event with additional dimensions. Parse will store a data point at the time of invocation with the given event name.
Dimensions will allow segmentation of the occurrences of this custom event. Keys and values should be NSStrings, and will throw otherwise.
To track a user signup along with additional metadata, consider the following:
NSDictionary *dimensions = @{ @“gender”: @“m”, @“source”: @“web”, @“dayType”: @“weekend” }; [PFAnalytics trackEvent:@“signup” dimensions:dimensions];
Warning
There is a default limit of 8 dimensions per event tracked.
Declaration
Objective-C
+ (id)trackEvent:(nonnull NSString *)name dimensions:(nullable NSDictionary<NSString *, NSString *> *)dimensions;Swift
class func trackEvent(_ name: String, dimensions: [String : String]?) -> Any!Parameters
nameThe name of the custom event to report to Parse as having happened.
dimensionsThe
NSDictionaryof information by which to segment this event.Return Value
Returns the task encapsulating the work being done.
-
Tracks the occurrence of a custom event with additional dimensions. Parse will store a data point at the time of invocation with the given event name. The event will be sent at some unspecified time in the future, even if Parse is currently inaccessible.
@discussion Dimensions will allow segmentation of the occurrences of this custom event. Keys and values should be NSStrings, and will throw otherwise.
To track a user signup along with additional metadata, consider the following: NSDictionary *dimensions = @{ @“gender”: @“m”, @“source”: @“web”, @“dayType”: @“weekend” }; [PFAnalytics trackEvent:@“signup” dimensions:dimensions];
There is a default limit of 8 dimensions per event tracked.
Declaration
Objective-C
+ (void)trackEventInBackground:(nonnull NSString *)name dimensions:(nullable NSDictionary<NSString *, NSString *> *) dimensions block:(nullable PFBooleanResultBlock)block;Swift
class func trackEvent(inBackground name: String, dimensions: [String : String]?, block: PFBooleanResultBlock? = nil)Parameters
nameThe name of the custom event to report to Parse as having happened.
dimensionsThe
NSDictionaryof information by which to segment this event.blockThe block to execute on server response. It should have the following argument signature:
^(BOOL succeeded, NSError *error)
View on GitHub
Install in Dash