MParticleOptions Class Reference

Inherits from NSObject
Declared in mParticle.h

Overview

Main configuration object for initial SDK setup.

+ optionsWithKey:secret:

Creates an options object with your specified App key and Secret.

+ (instancetype)optionsWithKey:(NSString *)apiKey secret:(NSString *)secret

Discussion

Creates an options object with your specified App key and Secret.

These values can be retrieved from your App’s dashboard within the mParticle platform.

Declared In

mParticle.h

  trackNotifications

Determines whether the mParticle Apple SDK will automatically track Remote and Local Notification events. Defaults to YES

@property (nonatomic, readwrite) BOOL trackNotifications

Discussion

Determines whether the mParticle Apple SDK will automatically track Remote and Local Notification events. Defaults to YES

Declared In

mParticle.h

  customLogger

A custom handler callback for mParticle log messages. If set, this block will be invoked each time mParticle would normally log a message to the console. N.B.: The format/wording of mParticle log messages may change between releases–please avoid using this programatically to detect SDK behavior unless absolutely necessary, and then only as a temporary workaround.

@property (nonatomic, copy, readwrite) void ( ^ ) ( NSString *message ) customLogger

Discussion

A custom handler callback for mParticle log messages. If set, this block will be invoked each time mParticle would normally log a message to the console. N.B.: The format/wording of mParticle log messages may change between releases–please avoid using this programatically to detect SDK behavior unless absolutely necessary, and then only as a temporary workaround.

Declared In

mParticle.h

  uploadInterval

Upload interval.

@property (nonatomic, readwrite) NSTimeInterval uploadInterval

Discussion

Upload interval.

Batches of data are sent periodically to the mParticle servers at the rate defined by this property. Batches are also uploaded when the application is sent to the background.

Declared In

mParticle.h

  sessionTimeout

Session timeout.

@property (nonatomic, readwrite) NSTimeInterval sessionTimeout

Discussion

Session timeout.

Sets the user session timeout interval. A session is ended if the app goes into the background for longer than the session timeout interval or when more than 1000 events are logged.

Declared In

mParticle.h

  networkOptions

Allows you to override the default HTTPS hosts and certificates used by the SDK, if required.

@property (nonatomic, strong, readwrite) MPNetworkOptions *networkOptions

Discussion

Allows you to override the default HTTPS hosts and certificates used by the SDK, if required.

(Provided to accomodate certain advanced use cases. Most integrations of the SDK will not require modifying this property.)

Declared In

mParticle.h

  consentState

Consent state.

@property (nonatomic, strong, nullable) MPConsentState *consentState

Discussion

Consent state.

Allows you to record one or more consent purposes and whether or not the user agreed to each one.

Declared In

mParticle.h

  dataPlanId

Data Plan ID.

@property (nonatomic, strong, readwrite, nullable) NSString *dataPlanId

Discussion

Data Plan ID.

If set, this informs the SDK of which data plan each event is supposed to conform to.

Declared In

mParticle.h

  dataPlanVersion

Data Plan Version.

@property (nonatomic, strong, readwrite, nullable) NSNumber *dataPlanVersion

Discussion

Data Plan Version.

If set, this informs the SDK of which version of the data plan each event is supposed to conform to.

Declared In

mParticle.h

  dataPlanOptions

Data Plan Options.

@property (nonatomic, strong, readwrite, nullable) MPDataPlanOptions *dataPlanOptions

Discussion

Data Plan Options.

Settings for blocking data to kits

Declared In

mParticle.h

  attStatus

Set the App Tracking Transparency Authorization Status upon starting the SDK. Only sets a new state if it has changed.

@property (nonatomic, strong, readwrite, nullable) NSNumber *attStatus

Discussion

Set the App Tracking Transparency Authorization Status upon starting the SDK. Only sets a new state if it has changed.

Declared In

mParticle.h

  attStatusTimestampMillis

Set the App Tracking Transparency Authorization Status timestamp upon starting the SDK. Requires @attStatus to be set and is only set if the authorization state is different from the stored state.

@property (nonatomic, strong, readwrite, nullable) NSNumber *attStatusTimestampMillis

Discussion

Set the App Tracking Transparency Authorization Status timestamp upon starting the SDK. Requires @attStatus to be set and is only set if the authorization state is different from the stored state.

Declared In

mParticle.h

  configMaxAgeSeconds

Set a maximum threshold for stored configuration age, in seconds.

@property (nonatomic, strong, readwrite, nullable) NSNumber *configMaxAgeSeconds

Discussion

Set a maximum threshold for stored configuration age, in seconds.

When the SDK starts, before we attempt to fetch a fresh config from the server, we will load the most recent previous config from disk. when configMaxAgeSeconds is set, we will check the timestamp on that config and, if its age is greater than the threshold, instead of loading it we will delete it and wait for the fresh config to arrive.

This field is especially useful if your application often updates the kit/forwarding logic and has a portion of user’s who experience prolonged network interruptions. In these cases, a reasonable configMaxAgeSeconds will prevent those users from potentially using very old forwarding logic.

Declared In

mParticle.h

  sideloadedKits

Set an array of instances of kit (MPKitProtocol wrapped in MPSideloadedKit) objects to be “sideloaded”.

@property (nonatomic, strong, readwrite, nullable) NSArray<MPSideloadedKit*> *sideloadedKits

Discussion

Set an array of instances of kit (MPKitProtocol wrapped in MPSideloadedKit) objects to be “sideloaded”.

The difference between these kits and mParticle UI enabled kits is that they do not receive a server side configuration and are always activated. Registration is done locally, and these kits will receive all of the usual MPKitProtocol callback method calls. Some use cases include debugging (logging all MPKitProtocol callbacks) and creating custom integrations that are not yet officially supported.

At the moment, all events are forwarded as event filtering is not yet supported. This will come in a future release.

Declared In

mParticle.h

  onIdentifyComplete

Identify callback.

@property (nonatomic, copy) void ( ^ ) ( MPIdentityApiResult *_Nullable apiResult , NSError *_Nullable error ) onIdentifyComplete

Discussion

Identify callback.

This will be called when an identify request completes.

This applies to both the initial identify request triggered by the SDK and any identify requests you may send.

Declared In

mParticle.h

  onAttributionComplete

Attribution callback.

@property (nonatomic, copy) void ( ^ ) ( MPAttributionResult *_Nullable attributionResult , NSError *_Nullable error ) onAttributionComplete

Discussion

Attribution callback.

This will be called each time a kit returns attribution info.

Declared In

mParticle.h

  onCreateBatch

Custom handler to modify or block batch data before upload.

@property (nonatomic, copy) NSDictionary *( ^ ) ( NSDictionary *batch ) onCreateBatch

Discussion

Custom handler to modify or block batch data before upload.

If set, this will be called when a new batch of data is created. By returning a different value, you can change the batch contents, or by returning ‘nil’ you can block the batch from being uploaded.

Use with care. This feature was initially added to allow the value of existing fields to be modified. If you add new data in a format that the platform is not expecting, it may be dropped or not parsed correctly.

Note: Use of this handler will also cause the field ‘mb’ (modified batch) to appear in the batch so we can distinguish for troubleshooting purposes whether data was changed.

Also note: Unlike other callbacks, this block will be called on the SDK queue to prevent batches from being processed out of order. Please avoid excessively blocking in this handler as this will prevent the SDK from doing other tasks.

Declared In

mParticle.h