ConnectCustomEvent
Use ConnectCustomEvent to instrument the Connect iOS library and capture custom events, errors, exceptions, network activity, geolocation, UI control interactions, and screen views.
Declared in ConnectCustomEvent.h.
Getting the shared instance
sharedInstance
Returns a shared instance of ConnectCustomEvent. Use this instance when logging custom events.
import Connect
ConnectCustomEvent.sharedInstance()#import <Connect/ConnectCustomEvent.h>
+ (ConnectCustomEvent *)sharedInstanceLogging custom events
You can log a specified event with or without also logging an associated value or dictionary.
logEvent
Logs a named event with no additional information or with a dictionary of key values.
logEvent(_ eventName: String?) -> Bool
logEvent(_ eventName: String?,
values: [AnyHashable : Any]?) -> Bool
logEvent(_ eventName: String?,
values: [AnyHashable : Any]?,
level: kConnectMonitoringLevelType) -> Bool- (BOOL)logEvent:(NSString *)eventName;
- (BOOL)logEvent:(NSString *)eventName
values:(NSDictionary *)values;
- (BOOL)logEvent:(NSString *)eventName
values:(NSDictionary *)values
level:(kConnectMonitoringLevelType)level;| Parameter | Required? | Description |
|---|---|---|
eventName | Required | The name of the event. Must not contain =, [, or ]. |
values | Optional | Additional key-value pairs to log with the event. Values must be NSDictionary, NSArray, NSString, NSNumber, or NSNull objects. |
level | Optional | The minimum logging level for the event. 0 — Ignore. 1 — CellularAndWiFi (default). 2 — WiFi only. Logging levels are nested — assign lower levels to more important events. |
NoteTo be convertible to a JSON representation, the values of the dictionary must be
NSDictionary,NSArray,NSString,NSNumberorNSNullobjects.
logSignal
Logs signal events and data.
logSignal(_ values: [AnyHashable : Any]?) -> Bool
logSignal(_ values: [AnyHashable : Any]?,
level: kConnectMonitoringLevelType) -> Bool- (BOOL)logSignal:(NSDictionary *)values;
- (BOOL)logSignal:(NSDictionary *)values
level:(kConnectMonitoringLevelType)level;| Parameter | Required? | Description |
|---|---|---|
values | Required | Key-value pairs to log with the signal. Values must be NSDictionary, NSArray, NSString, NSNumber, or NSNull objects. |
level | Optional | The minimum logging level for the event. 0 — Ignore. 1 — CellularAndWiFi (default). 2 — WiFi only. Logging levels are nested — assign lower levels to more important events. |
Logging error events
You can enable the library to log errors and exceptions.
logNSErrorEvent
Logs an error as described in the NSError instance.
logNSErrorEvent(_ error: (any Error)?,
message: String?,
level: kConnectMonitoringLevelType) -> Bool
logNSErrorEvent(_ error: (any Error)?,
message: String?,
file: UnsafePointer<Int8>?,
line: UInt, level: kConnectMonitoringLevelType) -> Bool
- (BOOL)logNSErrorEvent:(NSError _)error message:(NSString _)message [file:(const] char *)file line:(unsigned int)line level:(kConnectMonitoringLevelType)level;
- (BOOL)logNSErrorEvent:(NSError _)error message:(NSString _)message level:(kConnectMonitoringLevelType)level;Declared in ConnectCustomEvent.h. kConnectMonitoringLevelType is declared in ConnectPublicDefinitions.h.
This example shows expected JSON output:
{
"exception": {
"unhandled": false,
"data": {
"message": "Custom Message"
},
"name": "(null)",
"stackTrace": "",
"description": "An Error Occured,"
},
"fromWeb": false,
"count": 4,
"screenviewOffset": 23,
"offset": 39,
"type": 6,
"line": 1,
"fileName": "/path/to/file/AppDelegate.m"
}Supported JSON parameters:
| Parameter | Required? | Description |
|---|---|---|
error | Required | The NSError returned by the SDK or your own method. |
filename | Optional | The original file where the error occurred. The source code file name, usually from the FILE preprocessor macro. |
level | Required | The monitoring level of the event. The minimum logging level at which this error is logged. |
line | Optional | The source code line number, usually from the LINE preprocessor macro. |
message | Required | An associated message for your own |
return | Required | Shows whether the event was successfully logged or not. |
Logging exception events
Use this method to log exceptions.
logNSExceptionEvent
Enables the framework to log exceptions trapped by your own exception handler. These methods do not use the Cocoa SDK, which is not exception-safe. Sets the Unhandled flag to false.
This example shows how to call the method:
logNSExceptionEvent(_ exception: NSException?) -> Bool
logNSExceptionEvent(_ exception: NSException?,
dataDictionary: [AnyHashable : Any]?) -> Bool
logNSExceptionEvent(_ exception: NSException?,
dataDictionary: [AnyHashable : Any]?,
isUnhandled unhandled: Bool) -> Bool- (BOOL)logNSExceptionEvent:(NSException *)exception;
- (BOOL)logNSExceptionEvent:(NSException *)exception
dataDictionary:(NSDictionary *)dataDictionary;
- (BOOL)logNSExceptionEvent:(NSException *)exception
dataDictionary:(NSDictionary *)dataDictionary
isUnhandled:(BOOL)unhandled;Supported parameters:
| Parameter | Description |
|---|---|
exception | The caught NSexception instance. This value shows whether the event was successfully logged. |
dataDictionary | Additional data about the exception |
unhandled | Indicates whether the exception was caught by an exception handler. |
Logging exceptions in Swift
NSException codes are not supported for logging exceptions in Swift. Use the following code snippet instead.
enum MyError: ErrorType {
case RuntimeError(String)
case OutofIndex(String)
}
func throwError(message: String) throws {
throw MyError.RuntimeError(message)
}
func throwException(message: String) throws {
let info: [Int: String] = [1: "any"]
let exceptionInfo: [String: NSException] = [
"ExceptionObject": NSException(
name:
"TheException", reason: "WantToThrowNSException", userInfo: info)
]
throw NSError(domain: "exception", code: 10, userInfo: exceptionInfo)
}
@IBAction func generateUnhandledException(sender: UIButton) {
/* catching NSError with embedded NSException */
do {
try throwException("exceptionexception")
} catch let err as NSError {
let ex = err.userInfo["ExceptionObject"] as! NSException
ConnectCustomEvent.sharedInstance().logNSExceptionEvent(
ex, dataDictionary: info,
isUnhandled:
true)
ConnectCustomEvent.sharedInstance().logNSErrorEvent(
err, message: "error",
level:
kConnectMonitoringLevelType.ConnectMonitoringLevel1)
} catch let ex as NSException {
ConnectCustomEvent.sharedInstance().logNSExceptionEvent(
ex, dataDictionary: info,
isUnhandled:
true)
} catch {
print("unhandled")
}
}Swift assert errors and exceptions
logAssertErrorEvent
Logs a named event with no additional information.
logAssertErrorEvent(_ error: (any Error)?,
condition: Bool,
message: String?,
file: UnsafePointer<Int8>?,
line: UInt) -> Bool- (BOOL)logAssertErrorEvent:(NSError *)error
condition:(Boolean)condition
message:(NSString *)message
file:(const char *)file
line:(unsigned int)line;Required parameters:
| Parameter | Description |
|---|---|
condition | Condition to be logged. |
error | The error to be logged. |
file | The file in which the error occurred. Can be captured by passing FILE to the parameter. |
line | The line in which the error occurred. Can be captured by passing LINE to the parameter. |
message | Additional information to be logged with the error. |
logPreconditionErrorEvent
In the event of a precondition, this API enables logging of the error and flushing back captured data.
logPreconditionErrorEvent(_ error: (any Error)?,
condition: Bool,
message: String?,
file: UnsafePointer<Int8>?,
line: UInt) -> Bool- (BOOL)logPreconditionErrorEvent:(NSError *)
error condition:(Boolean)condition
message:(NSString *)message
file:(const char *)file
line:(unsigned int)line;Required parameters:
| Parameter | Description |
|---|---|
error | The error to be logged. |
condition | Condition to be logged. |
file | The file in which the error occurred. Can be captured by passing FILE to the parameter. |
line | The line in which the error occurred. Can be captured by passing LINE to the parameter. |
message | Additional information to be logged with the error. |
logAssertionFailureErrorEvent
In the event of an AssertionFailure, this API allows for the logging of the error and flushing back captured data.
logAssertionFailureErrorEvent(_ error: (any Error)?,
message: String?,
file: UnsafePointer<Int8>?,
line: UInt) -> Bool- (BOOL)logAssertionFailureErrorEvent:(NSError *)error
message:(NSString *)message
file:(const char *)file
line:(unsigned int)line;Required parameters:
| Parameter | Description |
|---|---|
error | The error to be logged. |
file | The file in which the error occurred. Can be captured by passing FILE to the parameter. |
line | The line in which the error occurred. Can be captured by passing LINE to the parameter. |
message | Additional information to be logged with the error. |
logPreconditionFailureErrorEvent
In the event of a PreconditionFailure, this API allows for the logging of the error and flushing back captured data.
logPreconditionFailureErrorEvent(_ error: (any Error)?,
message: String?,
file: UnsafePointer<Int8>?,
line: UInt) -> Bool- (BOOL)logPreconditionFailureErrorEvent:(NSError *)error
message:(NSString *)message
file:(const char *)file
line:(unsigned int)line;Required parameters:
| Parameter | Description |
|---|---|
error | The error to be logged. |
file | The file in which the error occurred. Can be captured by passing FILE to the parameter. |
line | The line in which the error occurred. Can be captured by passing LINE to the parameter. |
message | Additional information to be logged with the error. |
logFatalErrorEvent
In the event of a fatalError, this API allows for the logging of the error and flushing back captured data.
logFatalErrorEvent(_ error: (any Error)?,
message: String?,
file: UnsafePointer<Int8>?,
line: UInt) -> Bool- (BOOL)logFatalErrorEvent:(NSError *)error
message:(NSString *)message
file:(const char *)file
line:(unsigned int)line;Required parameters:
| Parameter | Description |
|---|---|
error | The error to be logged. |
file | The file in which the error occurred. Can be captured by passing FILE to the parameter. |
line | The line in which the error occurred. Can be captured by passing LINE to the parameter. |
message | Additional information to be logged with the error. |
Example
NSException codes are not supported for logging exceptions in Swift. Use the following code snippet instead.
enum MyError: ErrorType {
case RuntimeError(String)
case OutofIndex(String)
}
func throwError(message: String) throws {
throw MyError.RuntimeError(message)
}
func throwException(message: String) throws {
let info: [Int: String] = [1: "any"]
let exceptionInfo: [String: NSException] = [
"ExceptionObject": NSException(
name:
"TheException", reason: "WantToThrowNSException", userInfo: info)
]
throw NSError(domain: "exception", code: 10, userInfo: exceptionInfo)
}
@IBAction func generateUnhandledException(sender: UIButton) {
/* catching NSError with embedded NSException */
do {
try throwException("exceptionexception")
} catch let err as NSError {
let ex = err.userInfo["ExceptionObject"] as! NSException
ConnectCustomEvent.sharedInstance().logNSExceptionEvent(
ex, dataDictionary: info,
isUnhandled:
true)
ConnectCustomEvent.sharedInstance().logNSErrorEvent(
err, message: "error",
level:
kConnectMonitoringLevelType.ConnectMonitoringLevel1)
} catch let ex as NSException {
ConnectCustomEvent.sharedInstance().logNSExceptionEvent(
ex, dataDictionary: info,
isUnhandled:
true)
} catch {
print("unhandled")
}
}Network logging
logNSURLSession
Requests that the framework logs the connection information.
logNSURLSession(_ urlSession: Any?,
error: (any Error)?) -> Bool
logNSURLSession(_ urlSession: Any?,
response: URLResponse?,
responseTimeInMilliseconds responseTime: Int64) -> Bool
logNSURLSession(_ urlSession: Any?,
request: URLRequest?) -> Bool-(BOOL)logNSURLSession:(id)urlSession
error:(NSError*)error;
-(BOOL)logNSURLSession:(id)urlSession
response:(NSURLResponse*)response
responseTimeInMilliseconds:(long long)responseTime;
-(BOOL)logNSURLSession:(id)urlSession
request:(NSURLRequest*)request;Required parameters:
| Parameter | Description |
|---|---|
error | The error to be logged |
request | NSURLRequest object |
response | The NSURLResponse object from the connection request |
responseTime | The amount of time taken by the server to respond |
urlSession | The NSURLSession object |
logConnectionWithInitTime
Enables the framework to log connection information.
logConnection(withInitTime initTime: NSNumber?,
loadTime: NSNumber?,
connection: Any?,
request: URLRequest?,
response: URLResponse?,
error: (any Error)?) -> Bool
logConnection(withInitTime initTime: NSNumber?,
loadTime: NSNumber?,
connection: Any?,
request: URLRequest?,
response: URLResponse?,
data: Data?,
error: (any Error)?) -> Bool- (BOOL)logConnectionWithInitTime:(NSNumber*)initTime
loadTime:(NSNumber*)loadTime
connection:(id)connection
request:(NSURLRequest*)request
response:(NSURLResponse*)response
error:(NSError*)error;
- (BOOL)logConnectionWithInitTime:(NSNumber*)initTime
loadTime:(NSNumber*)loadTime
connection:(id)connection
request:(NSURLRequest*)request
response:(NSURLResponse*)response
data:(NSData*)data
error:(NSError*)error;Required parameters:
| Parameter | Description |
|---|---|
connection | The NSURLSession object, can be nil. |
data | The NSData object from the connection request or response. |
error | NSError object. |
initTime | Time duration since the start of the current session |
loadTime | The amount of time it takes to load |
request | The NSURLRequest object associated with the connection. |
response | The NSURLResponse object from the connection request. |
Geolocation logging
Use this method to have the framework log a geographic location at a specific point in your application. Location events aren't enabled by default. Location must be reported only when the application has a reason to request it. This helps avoid making unnecessary location updates and to protect the privacy of your application users.
logLocation(_ location: CLLocation?) -> Bool
logLocationUpdateEvent(withLatitude lat: Double,
longitude lng: Double,
level: kConnectMonitoringLevelType) -> Bool-(BOOL)logLocation:(CLLocation *)location;
-(BOOL)logLocationUpdateEventWithLatitude:(double)lat
longitude:(double)lng
level:(kConnectMonitoringLevelType)level;Call logLocation from your CLLocationManagerDelegate handler. Your application must include the Core Location framework.
func locationManager(_ manager: CLLocationManager,
didUpdateLocations locations: [CLLocation]) {
if let location = locations.last {
ConnectCustomEvent.sharedInstance().logLocation(location)
}
}- (void)locationManager:(CLLocationManager *)manager
didUpdateLocations:(NSArray<CLLocation *> *)locations {
CLLocation *location = locations.lastObject;
[[ConnectCustomEvent sharedInstance] logLocation:location];
}Required parameters:
| Parameter | Description |
|---|---|
latitude | The latitude to log |
level | The minimum logging level for locations |
location | A CLLocation Object containing a location of interest |
longitude | The longitude to log |
UIControls events
logClickEvent
Enables the framework to log tclick events on any UIControl or UIView. A click event is a normalized form of touch up inside event.
logClickEvent(_ view: UIView?,
data: [AnyHashable : Any]?) -> Bool
logClickEvent(_ view: UIView?,
controlId: String?,
data: [AnyHashable : Any]?) -> Bool-(BOOL)logClickEvent:(UIView*)view
data:(NSDictionary*)data;
-(BOOL)logClickEvent:(UIView*)view
controlId:(NSString*)controlId
data:(NSDictionary*)data;Required parameters:
| Parameter | Description |
|---|---|
controlId | The ID of the control to be used. |
data | Any additional custom data that needs to be sent as a dictionary along with the click event. |
view | UIView object on which click event occurred. |
logValueChangeEvent
Requests that the framework logs the UITableViewCell or UICollectionViewCell's content changed event.
logValueChangeEvent(_ view: UIView?,
data: [AnyHashable : Any]?) -> Bool
logValueChangeEvent(_ view: UIView?,
controlId: String?,
data: [AnyHashable : Any]?) -> Bool-(BOOL)logValueChangeEvent:(UIView*)view
data:(NSDictionary*)data;
-(BOOL)logValueChangeEvent:(UIView*)view
controlId:(NSString*)controlId
data:(NSDictionary*)data;Required parameters:
| Parameter | Description |
|---|---|
controlId | The ID of the control to be used |
data | Any additional custom data that needs to be sent as a dictionary along with the click event |
view | UIView object on which click event occurred |
logTextChangeEvent
Requests that the framework logs the edit event on UITextView, UITextViewSecure, UITextField or UITextFieldSecure.
logTextChangeEvent(_ view: UIView?,
data: [AnyHashable : Any]?) -> Bool
logTextChangeEvent(_ view: UIView?,
controlId: String?,
data: [AnyHashable : Any]?) -> Bool-(BOOL)logTextChangeEvent:(UIView*)view
data:(NSDictionary*)data;
-(BOOL)logTextChangeEvent:(UIView*)view
controlId:(NSString*)controlId
data:(NSDictionary*)data;Required parameters:
| Parameter | Description |
|---|---|
controlId | The ID of the control to be used. |
data | Any additional custom data that needs to be sent as a dictionary along with the click event. |
view | UIView object on which a click event occurred. |
logUILabelTextChange
Used to log when a label changes.
logUILabelTextChange(_ label: UILabel?) -> Bool
logUILabelTextChange(_ label: UILabel?,
controlId: String?) -> Bool- (BOOL)logUILabelTextChange:(UILabel*)label;
- (BOOL)logUILabelTextChange:(UILabel*)label
controlId:(NSString*)controlId;Required parameters:
| Parameter | Description |
|---|---|
controlId | The ID of the control to be used. |
label | The UILabel to be logged. |
logFormCompletion
Message type to indicate form completion on view.
logFormCompletion(_ submitted: Bool) -> Bool
logFormCompletion(_ submitted: Bool,
withValidData isValid: Bool) -> Bool-(BOOL)logFormCompletion:(BOOL)submitted;
-(BOOL)logFormCompletion:(BOOL)submitted
withValidData:(BOOL)isValid;Required parameters:
| Parameter | Description |
|---|---|
isValid | Indicates if the submitted input data was valid or not. |
submitted | Indicates if form/input data was submitted or not. |
Screenview
logScreenViewPageName
Sets the logical page name for screen layout captures. Used for React Native apps.
logScreenViewPageName(_ logicalPageName: String?) -> Bool-(BOOL)logScreenViewPageName:(NSString*)logicalPageName;Required parameters:
| Parameter | Description |
|---|---|
logicalPageName | Page name or title e.g. "Login View Controller". Must not be empty. |
logScreenViewContext
Requests that the framework logs an application context.
logScreenViewContext(_ logicalPageName: String?,
withClass clsss: String?,
applicationContext screenViewType: ConnectScreenViewType,
referrer: String?) -> Bool-(BOOL)logScreenViewContext:(NSString*)logicalPageName
withClass:(NSString *)clsss
applicationContext:(ConnectScreenViewType)screenViewType
referrer:(NSString*)referrer;Required parameters:
| Parameter | Description |
|---|---|
applicationContext | Valid values are ConnectScreenViewTypeLoad or ConnectScreenViewTypeUnload. Must not be empty. |
logicalPageName | Page name or title e.g. "Login View Controller". Must not be empty. |
referrer | Page name or title that loads logicalPageName. Can be empty. |
withClass | Class of UIViewcontroller. Must not be empty. |
logPrintScreenEvent
Requests that the framework logs a Print Screen event. The screenshot in that moment is automatically associated.
logPrintScreenEvent() -> Bool- (BOOL)logPrintScreenEvent;logScreenLayoutWithImage
Requests that the framework log an image as a background in a screen layout capture event.
logScreenLayout(with image: UIImage?) -> Bool- (BOOL)logScreenLayoutWithImage:(UIImage *)image;Required parameters:
| Parameter | Description |
|---|---|
image | UIImage object that needs to be added as a background for the layout. |
logScreenLayoutWithViewController
Enables the framework to log the layout of the screen.
logScreenLayout(with viewController: UIViewController?) -> Bool
logScreenLayout(with viewController: UIViewController?,
andName name: String?) -> Bool
logScreenLayout(with viewController: UIViewController?,
andDelay delay: CGFloat) -> Bool
logScreenLayout(with viewController: UIViewController?,
andDelay delay: CGFloat,
andName name: String?) -> Bool
logScreenLayout(with viewController: UIViewController?,
andRelatedViews views: [AnyHashable]?,
andDelay delay: CGFloat) -> Bool
logScreenLayout(with viewController: UIViewController?,
andRelatedViews views: [AnyHashable]?) -> Bool
logScreenLayout(with viewController: UIViewController?,
andRelatedViews views: [AnyHashable]?,
andName name: String?) -> Bool
logScreenLayout(with viewController: UIViewController?,
andRelatedViews views: [AnyHashable]?,
andName name: String?) -> Bool
logScreenLayout(with viewController: UIViewController?,
andRelatedViews views: [AnyHashable]?,
andDelay delay: CGFloat,
andName name: String?) -> Bool-(BOOL)logScreenLayoutWithViewController:(UIViewController *)viewController;
-(BOOL)logScreenLayoutWithViewController:(UIViewController *)viewController
andName:(NSString*)name;
-(BOOL)logScreenLayoutWithViewController:(UIViewController *)viewController
andDelay:(CGFloat)delay;
-(BOOL)logScreenLayoutWithViewController:(UIViewController *)viewController
andDelay:(CGFloat)delay
andName:(NSString*)name;
-(BOOL)logScreenLayoutWithViewController:(UIViewController *)viewController
andRelatedViews:(NSArray*)views
andDelay:(CGFloat)delay;
-(BOOL)logScreenLayoutWithViewController:(UIViewController *)viewController
andRelatedViews:(NSArray*)views;
-(BOOL)logScreenLayoutWithViewController:(UIViewController *)viewController
andRelatedViews:(NSArray*)views
andName:(NSString*)name;
-(BOOL)logScreenLayoutWithViewController:(UIViewController *)viewController
andRelatedViews:(NSArray*)views
andDelay:(CGFloat)delay
andName:(NSString*)name;Required parameters:
| Parameter | Description |
|---|---|
delay | The number of seconds to wait before logging the view. |
name | The custom name to associate with the view controller. |
viewController | The UIViewController object which layout needs to be logged. |
views | Array of views that will be logged along with the provided viewController. |
logJSONMessagePayloadStr
Enables the framework to log the Connect JSON Message coming over from JavaScript. Must follow the JSON message format.
logJSONMessagePayloadStr(_ payload: String?) -> Bool-(BOOL)logJSONMessagePayloadStr:(NSString*)payload;Required parameters:
| Parameter | Description |
|---|---|
payload | NSString object that matches the Connect JSON Message type format. |
logImageUrl
Add URL to UIImage to be used as a reference for replay.
logImageUrl(_ image: UIImage?,
withUrl url: String?) -> Bool-(BOOL)logImageUrl:(UIImage*)image
withUrl:(NSString*)url;Required parameters:
| Parameter | Description |
|---|---|
image | UIImage used |
url | The URL of the image |
logPerformance
Log performance data.
logPerformance(_ navigationStart: NSNumber?,
unloadEventStart: NSNumber?,
unloadEventEnd: NSNumber?,
redirectStart: NSNumber?,
redirectEnd: NSNumber?,
fetchStart: NSNumber?,
domainLookupStart: NSNumber?,
domainLookupEnd: NSNumber?,
connectStart: NSNumber?,
connectEnd: NSNumber?,
secureConnectionStart: NSNumber?,
requestStart: NSNumber?,
responseStart: NSNumber?,
responseEnd: NSNumber?,
domLoading: NSNumber?,
domInteractive: NSNumber?,
domContentLoadedEventStart: NSNumber?,
domContentLoadedEventEnd: NSNumber?,
domComplete: NSNumber?,
loadEventStart: NSNumber?,
loadEventEnd: NSNumber?,
renderTime: NSNumber?,
perNavType: NSNumber?,
redirectCount: NSNumber?) -> Bool-(BOOL)logPerformance:(NSNumber*)navigationStart
unloadEventStart:(NSNumber*)unloadEventStart
unloadEventEnd:(NSNumber*)unloadEventEnd
redirectStart:(NSNumber*)redirectStart
redirectEnd:(NSNumber*)redirectEnd
fetchStart:(NSNumber*)fetchStart
domainLookupStart:(NSNumber*)domainLookupStart
domainLookupEnd:(NSNumber*)domainLookupEnd
connectStart:(NSNumber*)connectStart
connectEnd:(NSNumber*)connectEnd
secureConnectionStart:(NSNumber*)secureConnectionStart
requestStart:(NSNumber*)requestStart
responseStart:(NSNumber*)responseStart
responseEnd:(NSNumber*)responseEnd
domLoading:(NSNumber*)domLoading
domInteractive:(NSNumber*)domInteractive
domContentLoadedEventStart:(NSNumber*)domContentLoadedEventStart
domContentLoadedEventEnd:(NSNumber*)domContentLoadedEventEnd
domComplete:(NSNumber*)domComplete
loadEventStart:(NSNumber*)loadEventStart
loadEventEnd:(NSNumber*)loadEventEnd
renderTime:(NSNumber*)renderTime
perNavType:(ConnectPerformanceNavigationType)perNavType
redirectCount:(NSNumber*)redirectCount;Required parameters:
| Parameter | Description |
|---|---|
connectEnd | This attribute must return the time immediately after the user agent finishes establishing the connection to the server to retrieve the current document. If a persistent connection [RFC 2616] is used or the current document is retrieved from relevant application caches or local resources, this attribute must return the value of domainLookupEnd. |
connectStart | This attribute must return the time immediately before the user agent starts establishing the connection to the server to retrieve the document. If a persistent connection [RFC 2616] is used or the current document is retrieved from relevant application caches or local resources, this attribute must return value of domainLookupEnd. |
domainLookupEnd | This attribute must return the time immediately after the user agent finishes the domain name lookup for the current document. If a persistent connection [RFC 2616] is used or the current document is retrieved from relevant application caches or local resources, this attribute must return the same value as fetchStart. |
domainLookupStart | This attribute must return the time immediately before the user agent starts the domain name lookup for the current document. If a persistent connection [RFC 2616] is used or the current document is retrieved from relevant application caches or local resources, this attribute must return the same value as fetchStart. |
domComplete | This attribute must return the time immediately before the user agent sets the current document readiness to "complete". |
domContentLoadedEventEnd | This attribute must return the time immediately after the document's DOMContentLoaded event completes. |
domContentLoadedEventStart | This attribute must return the time immediately before the user agent fires the DOMContentLoaded event at the Document. |
domInteractive | This attribute must return the time immediately before the user agent sets the current document readiness to "interactive". |
domLoading | This attribute must return the time immediately before the user agent sets the current document readiness to "loading". |
fetchStart | If the new resource is to be fetched using HTTP GET or equivalent, fetchStart must return the time immediately before the user agent starts checking any relevant application caches. Otherwise, it must return the time when the user agent starts fetching the resource. |
loadEventEnd | This attribute must return the time when the load event of the current document is completed. It must return zero when the load event is not fired or is not completed. |
loadEventStart | This attribute must return the time immediately before the load event of the current document is fired. It must return zero when the load event is not fired yet. |
navigationStart | This attribute must return the time immediately after the user agent finishes prompting to unload the previous document. If there is no previous document, this attribute must return the same value as fetchStart. |
perNavType | This attribute must return the type of the last non-redirect navigation in the current browsing context. |
redirectCount | This attribute must return the number of redirects since the last non-redirect navigation under the current browsing context. If there is no redirect or there is any redirect that is not from the same origin as the destination document, this attribute must return zero. |
redirectEnd | If there are HTTP redirects or equivalent when navigating and all redirects and equivalents are from the same origin, this attribute must return the time immediately after receiving the last byte of the response of the last redirect. Otherwise, this attribute must return zero. |
redirectStart | If there are HTTP redirects or equivalent when navigating and if all the redirects or equivalent are from the same origin, this attribute must return the starting time of the fetch that initiates the redirect. Otherwise, this attribute must return zero. |
renderTime | The amount of time it took to render the page. |
requestStart | This attribute must return the time immediately before the user agent starts requesting the current document from the server, or from relevant application caches or from local resources. |
responseEnd | This attribute must return the time immediately after the user agent receives the last byte of the current document or immediately before the transport connection is closed, whichever comes first. The document here can be received either from the server, relevant application caches or from local resources. |
responseStart | This attribute must return the time immediately after the user agent receives the first byte of the response from the server, or from relevant application caches or from local resources. |
unloadEventEnd | If the previous document and the current document have the same origin, this attribute must return the time immediately after the user agent finishes the unload event of the previous document. If there is no previous document or the previous document has a different origin than the current document or the unload is not yet completed, this attribute must return zero. If there are HTTP redirects or equivalent when navigating and not all the redirects or equivalent are from the same origin, both unloadEventStart and unloadEventEnd must return zero. |
unloadEventStart | If the previous document and the current document have the same origin [IETF RFC 6454], this attribute must return the time immediately before the user agent starts the unload event of the previous document. If there is no previous document or the previous document has a different origin than the current document, this attribute must return zero. |
Optional parameters:
| Parameter | Description |
|---|---|
secureConnectionStart | User agents that don't have this attribute available must set it as undefined. When this attribute is available, if the scheme of the current page is HTTPS, this attribute must return the time immediately before the user agent starts the handshake process to secure the current connection. If this attribute is available but HTTPS is not used, this attribute must return zero. |
Screen layout logging
Use these methods to manually log screen layouts for session replay. For guidance on when and how to call them, see Log screen layouts manually.
logScreenLayoutWithImage
Logs an image as the background for a screen layout capture event. Returns false if the image is nil or logging fails.
logScreenLayout(with image: UIImage?) -> Bool- (BOOL)logScreenLayoutWithImage:(UIImage *)image;| Parameter | Required? | Description |
|---|---|---|
image | Required | The UIImage to log as the screen background. |
logScreenLayoutWithViewController
Logs the layout of the specified view controller. Supports optional delay, custom name, and related views.
logScreenLayout(with viewController: UIViewController?) -> Bool
logScreenLayout(with viewController: UIViewController?,
andName name: String?) -> Bool
logScreenLayout(with viewController: UIViewController?,
andDelay delay: CGFloat) -> Bool
logScreenLayout(with viewController: UIViewController?,
andDelay delay: CGFloat,
andName name: String?) -> Bool
logScreenLayout(with viewController: UIViewController?,
andRelatedViews views: [AnyHashable]?) -> Bool
logScreenLayout(with viewController: UIViewController?,
andRelatedViews views: [AnyHashable]?,
andName name: String?) -> Bool
logScreenLayout(with viewController: UIViewController?,
andRelatedViews views: [AnyHashable]?,
andDelay delay: CGFloat) -> Bool
logScreenLayout(with viewController: UIViewController?,
andRelatedViews views: [AnyHashable]?,
andDelay delay: CGFloat,
andName name: String?) -> Bool-(BOOL)logScreenLayoutWithViewController:(UIViewController *)viewController;
-(BOOL)logScreenLayoutWithViewController:(UIViewController *)viewController
andName:(NSString *)name;
-(BOOL)logScreenLayoutWithViewController:(UIViewController *)viewController
andDelay:(CGFloat)delay;
-(BOOL)logScreenLayoutWithViewController:(UIViewController *)viewController
andDelay:(CGFloat)delay
andName:(NSString *)name;
-(BOOL)logScreenLayoutWithViewController:(UIViewController *)viewController
andRelatedViews:(NSArray *)views;
-(BOOL)logScreenLayoutWithViewController:(UIViewController *)viewController
andRelatedViews:(NSArray *)views
andName:(NSString *)name;
-(BOOL)logScreenLayoutWithViewController:(UIViewController *)viewController
andRelatedViews:(NSArray *)views
andDelay:(CGFloat)delay;
-(BOOL)logScreenLayoutWithViewController:(UIViewController *)viewController
andRelatedViews:(NSArray *)views
andDelay:(CGFloat)delay
andName:(NSString *)name;| Parameter | Required? | Description |
|---|---|---|
viewController | Required | The UIViewController whose layout to log. |
delay | Optional | Seconds to wait before capturing. Use when animations or data reloads must complete first. |
name | Optional | A custom name for the captured layout. Useful when a view controller serves multiple functions. |
views | Optional | Additional views outside the main view hierarchy to include in the capture — for example, alerts or overlays. |
Updated 4 days ago
