YMMYandexMetricaReporting protocol
Instance methods
pauseSession() | Pauses the user session. |
report(eCommerce:onFailure:) | Sends a message about an E-commerce event. |
reportError(_:exception:onFailure:) | Sends a custom error message. Attention. Deprecated method. |
report(error:onFailure:) | Sends a |
report(error:options:onFailure:) | Sends a |
report(nserror:onFailure:) | Sends an |
report(nserror:options:onFailure:) | Sends an |
report(adRevenue:onFailure:) | Sends information about advertising revenue to the AppMetrica server. |
reportEvent(_:onFailure:) | Sends a custom event message. |
reportEvent(_:parameters:onFailure:) | Sends a custom event message with additional parameters. |
reportRevenue(_:onFailure:) | Sends information about the purchase to the AppMetrica server. |
report(_: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. |
sendEventsBuffer() | Sends stored events from the buffer. |
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. |
report(eCommerce:onFailure:) | Sends a message about an E-commerce event. |
reportError(_:exception:onFailure:) | Sends a custom error message. Attention. Deprecated method. |
report(error:onFailure:) | Sends a |
report(error:options:onFailure:) | Sends a |
report(nserror:onFailure:) | Sends an |
report(nserror:options:onFailure:) | Sends an |
report(adRevenue:onFailure:) | Sends information about advertising revenue to the AppMetrica server. |
reportEvent(_:onFailure:) | Sends a custom event message. |
reportEvent(_:parameters:onFailure:) | Sends a custom event message with additional parameters. |
reportRevenue(_:onFailure:) | Sends information about the purchase to the AppMetrica server. |
report(_: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. |
sendEventsBuffer() | Sends stored events from the buffer. |
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()
func pauseSession()
Pauses the user session.
report(eCommerce:onFailure:)
class func report(eCommerce: YMMECommerce, onFailure: ((Error) -> Void)? = nil)
Sends a message about an E-commerce event.
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:)
func reportError(_ name: String, exception: NSException?, onFailure: ((Error) -> Void)? = nil)
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. |
report(error:onFailure:)
func report(error: YMMErrorRepresentable, onFailure: ((Error) -> Void)? = nil)
Sends a YMMErrorRepresentable
message.
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. |
report(error:options:onFailure:)
func report(error: YMMErrorRepresentable, options: YMMErrorReportingOptions = [], onFailure: ((Error) -> Void)? = nil)
Sends a YMMErrorRepresentable
message.
Use this method to set the send 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. |
report(nserror:onFailure:)
func report(nserror error: Error, onFailure: ((Error) -> Void)? = nil)
Sends an NSError
message.
AppMetrica uses the domain and code to group errors.
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 inuserInfo
. - 200 stack frames in the
YMMBacktraceErrorKey
backtrace as a key inuserInfo
.
NSError
. For more information, see the YMMBacktraceErrorKey constant description.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. |
report(nserror:options:onFailure:)
func report(nserror error: Error, options: YMMErrorReportingOptions = [], onFailure: ((Error) -> Void)? = nil)
Sends an NSError
message.
AppMetrica uses the domain and code to group errors.
Use this method to set the send parameters.
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 inuserInfo
. - 200 stack frames in the
YMMBacktraceErrorKey
backtrace as a key inuserInfo
.
NSError
. For more information, see the YMMBacktraceErrorKey constant description.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. |
report(adRevenue:onFailure:)
func report(_ adRevenue: YMMAdRevenueInfo, onFailure: ((NSError) -> Void)?)
Sends information about advertising revenue to the AppMetrica server.
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. |
reportEvent(_:onFailure:)
func reportEvent(_ name: String, onFailure: ((Error) -> Void)? = nil)
Sends a custom event message.
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. |
reportEvent(_:parameters:onFailure:)
func reportEvent(_ name: String, parameters params: [AnyHashable : Any]?, onFailure: ((Error) -> Void)? = nil)
Sends a custom event message with additional 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:)
func reportRevenue(_ revenueInfo: YMMRevenueInfo, onFailure: ((NSError) -> Void)?)
Sends information about the purchase to the AppMetrica server.
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:)
func reportUserProfile(_ userProfile: YMMUserProfile, onFailure: ((NSError) -> Void)?)
Sends information about the user profile update to the AppMetrica server.
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()
func resumeSession()
Resumes the session, or creates a new one if the session timeout has expired.
sendEventsBuffer()
func sendEventsBuffer()
Sends stored events from the buffer.
AppMetrica SDK does not send an event immediately after it occurred. The library stores event data in the buffer. Method
sendEventsBuffer
()sends data from the buffer and flushes it. Use the method to force sending stored events after passing important checkpoints of user scenarios.
Frequent use of the method can lead to increased outgoing internet traffic and energy consumption.
setStatisticsSending(_:)
func setStatisticsSending(_ enabled: Bool)
Enables/disables sending statistics to the AppMetrica server.
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.
enabled | A flag indicating that sending statistics is enabled. The default value is true .Possible values:
|
enabled | A flag indicating that sending statistics is enabled. The default value is true .Possible values:
|
setUserProfileID(_:)
func setUserProfileID(_ userProfileID: String?)
Sets the ID of the user profile. If the
ProfileId
isn't sent, predefined attributes aren't displayed in the web interface.
userProfileID | User profile ID. |
userProfileID | User profile ID. |