YMMYandexMetricaReporting protocol

Instance methods

-pauseSession Pauses the user session.
-reportAdRevenue:onFailure: Sends information about advertising revenue to the AppMetrica server.
+reportECommerce:onFailure:

Sends a message about an E-commerce event.

-reportError:exception:onFailure:
Sends a custom error message.
Attention. Deprecated method.
+reportError:onFailure:

Sends a YMMErrorRepresentable message.

+reportError:options:onFailure:

Sends a YMMErrorRepresentable message.

+reportNSError:onFailure:

Sends an NSError message.

+reportNSError:options:onFailure:

Sends an NSError message.

-reportEvent:onFailure:

Sends a custom event message.

-reportEvent:params:onFailure:

Sends a custom event message with additional parameters.

-reportRevenue:onFailure: Sends information about the purchase to the AppMetrica server.
-reportUserProfile:onFailure: Sends information about the user profile update to the AppMetrica server.
-resumeSession

Resumes the session, or creates a new one if the session timeout has expired.

-setStatisticsSending: Enables/disables sending statistics to the AppMetrica server.
-setUserProfileID: Sets the ID of the user profile. AppMetrica doesn't display predefined attributes in the web interface if ProfieId sending isn't configured.
-pauseSession Pauses the user session.
-reportAdRevenue:onFailure: Sends information about advertising revenue to the AppMetrica server.
+reportECommerce:onFailure:

Sends a message about an E-commerce event.

-reportError:exception:onFailure:
Sends a custom error message.
Attention. Deprecated method.
+reportError:onFailure:

Sends a YMMErrorRepresentable message.

+reportError:options:onFailure:

Sends a YMMErrorRepresentable message.

+reportNSError:onFailure:

Sends an NSError message.

+reportNSError:options:onFailure:

Sends an NSError message.

-reportEvent:onFailure:

Sends a custom event message.

-reportEvent:params:onFailure:

Sends a custom event message with additional parameters.

-reportRevenue:onFailure: Sends information about the purchase to the AppMetrica server.
-reportUserProfile:onFailure: Sends information about the user profile update to the AppMetrica server.
-resumeSession

Resumes the session, or creates a new one if the session timeout has expired.

-setStatisticsSending: Enables/disables sending statistics to the AppMetrica server.
-setUserProfileID: Sets the ID of the user profile. AppMetrica doesn't display predefined attributes in the web interface if ProfieId sending isn't configured.

Method descriptions

-pauseSession

- (void)pauseSession

Pauses the user session.

-reportAdRevenue:onFailure:

- (void)reportAdRevenue:(YMMAdRevenueInfo *)adRevenue
              onFailure:(nullable void (^)(NSError *error))onFailure

Sends information about advertising revenue to the AppMetrica server.

Parameters:
adRevenue

The instance of the YMMAdRevenueInfo class which contains information about advertising revenue.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

adRevenue

The instance of the YMMAdRevenueInfo class which contains information about advertising revenue.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

+reportECommerce:onFailure:

+ (void)reportECommerce:(YMMECommerce *)eCommerce
              onFailure:(nullable void (^)(NSError *error))onFailure

Sends a message about an E-commerce event.

Parameters:
eCommerce

The YMMECommerce class instance.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

eCommerce

The YMMECommerce class instance.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

-reportError:exception:onFailure:

- (void)reportError:(NSString *)name
          exception:(nullable NSException *)exception
          onFailure:(nullable void (^)(NSError *error))onFailure
Sends a custom error message.
Attention. Deprecated method.
Parameters:
name

Short name or description of the error.

exception

The instance of the NSException class.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

name

Short name or description of the error.

exception

The instance of the NSException class.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

-reportEvent:onFailure:

- (void)reportEvent:(NSString *)name
          onFailure:(nullable void (^)(NSError *error))onFailure

Sends a custom event message.

Parameters:
name

Short name or description of the event

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

name

Short name or description of the event

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

+reportError:onFailure:

- (void)reportError:(nonnull id<YMMErrorRepresentable>)error
               onFailure:(void (^)(NSError *error))onFailure

Sends a YMMErrorRepresentable message.

Note. For more information, see the YMMErrorRepresentable protocol description.
Parameters:
error

The error to send.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

error

The error to send.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

+reportError:options:onFailure:

- (void)reportNSError:(nonnull id<YMMErrorRepresentable>)error
               options:(YMMErrorReportingOptions)options
               onFailure:(void (^)(NSError *error))onFailure

Sends a YMMErrorRepresentable message.

Use this method to set the send parameters.

Note. For more information, see the YMMErrorRepresentable protocol description.
Parameters:
error

The error to send.

options

Parameters for sending an error.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

error

The error to send.

options

Parameters for sending an error.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

+reportError:onFailure:

- (void)reportNSError:(NSError *)error
               onFailure:(void (^)(NSError *error))onFailure

Sends an NSError message.

AppMetrica uses the domain and code to group errors.

Limits for an NSError:
  • 200 characters for the domain.
  • 50 key-value pairs for userInfo, 100 characters for the key, and 2000 characters for the value.
  • 10 nested errors that use NSUnderlyingErrorKey as a key in userInfo.
  • 200 stack frames in the YMMBacktraceErrorKey backtrace as a key in userInfo.
If the value exceeds the limit, AppMetrica truncates it.
Note. You can send your own error backtrace in NSError. For more information, see the YMMBacktraceErrorKey constant description.
Parameters:
error

The error to send.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

error

The error to send.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

+reportNSError:options:onFailure:

- (void)reportNSError:(NSError *)error
               options:(YMMErrorReportingOptions)options
               onFailure:(void (^)(NSError *error))onFailure

Sends an NSError message.

AppMetrica uses the domain and code to group errors.

Use this method to set the send parameters.

Limits for an NSError:
  • 200 characters for the domain.
  • 50 key-value pairs for userInfo, 100 characters for the key, and 2000 characters for the value.
  • 10 nested errors that use NSUnderlyingErrorKey as a key in userInfo.
  • 200 stack frames in the YMMBacktraceErrorKey backtrace as a key in userInfo.
If the value exceeds the limit, AppMetrica truncates it.
Note. You can send your own error backtrace in NSError. For more information, see the YMMBacktraceErrorKey constant description.
Parameters:
error

The error to send.

options

Parameters for sending an error.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

error

The error to send.

options

Parameters for sending an error.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

-reportEvent:params:onFailure:

- (void)reportEvent:(NSString *)name
         parameters:(nullable NSDictionary *)params
          onFailure:(nullable void (^)(NSError *error))onFailure

Sends a custom event message with additional parameters.

Parameters:
name

Short name or description of the event

params

Parameters as “key-value” pairs.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

name

Short name or description of the event

params

Parameters as “key-value” pairs.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

-reportRevenue:onFailure:

- (void)reportRevenue:(YMMRevenueInfo *)revenueInfo
            onFailure:(nullable void (^)(NSError *error))onFailure

Sends information about the purchase to the AppMetrica server.

Parameters:
revenueInfo

The instance of the YMMRevenueInfo class which contains information about a purchase.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

revenueInfo

The instance of the YMMRevenueInfo class which contains information about a purchase.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

-reportUserProfile:onFailure:

- (void)reportUserProfile:(YMMUserProfile *)userProfile
                onFailure:(nullable void (^)(NSError *error))onFailure

Sends information about the user profile update to the AppMetrica server.

Parameters:
userProfile

The instance of the YMMUserProfileclass which contains information about the user profile.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

userProfile

The instance of the YMMUserProfileclass which contains information about the user profile.

onFailure

The block that is executed when an error occurs. The error is passed as a block argument.

-resumeSession

- (void)resumeSession

Resumes the session, or creates a new one if the session timeout has expired.

-setStatisticsSending:

- (void)setStatisticsSending:(BOOL)enabled

Enables/disables sending statistics to the AppMetrica server.

Note.

Disable sending statistics to the reporter does not affect the sending of data from the main API key. But disabling data sending for the main API key stops sending statistics from all reporters.

Parameters:
enabled

A flag indicating that sending statistics is enabled.

The default value is YES.

Possible values:

  • YES — Sending statistics is enabled.
  • NO — Sending statistics is disabled.
enabled

A flag indicating that sending statistics is enabled.

The default value is YES.

Possible values:

  • YES — Sending statistics is enabled.
  • NO — Sending statistics is disabled.

-setUserProfileID:

-(void)setUserProfileID:(nullable NSString *)userProfileID

Sets the ID of the user profile. If the

ProfileId

isn't sent, predefined attributes aren't displayed in the web interface.

Parameters:
userProfileID User profile ID.
userProfileID User profile ID.