MPCommerceEvent Class Reference
| Inherits from | MPBaseEvent : NSObject |
|---|---|
| Conforms to | NSSecureCoding |
| Declared in | MPCommerceEvent.h |
Overview
This class contains the information and represents a commerce event to be logged using the mParticle SDK.
Usage:
Swift
let commerceEvent = MPCommerceEvent(action: MPCommerceEventAction.AddToCart, product: product1)
let mParticle = MParticle.sharedInstance()
mParticle.logCommerceEvent(commerceEvent)
Objective-C
MPCommerceEvent *commerceEvent = [[MPCommerceEvent alloc] initWithAction:MPCommerceEventActionAddToCart product:product1];
MParticle *mParticle = [MParticle sharedInstance];
[mParticle logCommerceEvent:commerceEvent];
Other Methods
checkoutOptions
Checkout option string describing what the options are.
@property (nonatomic, strong, nullable) NSString *checkoutOptionsDiscussion
Checkout option string describing what the options are.
Declared In
MPCommerceEvent.h
currency
The currency used in the commerce event.
@property (nonatomic, strong, nullable) NSString *currencyDiscussion
The currency used in the commerce event.
Declared In
MPCommerceEvent.h
impressions
A dictionary containing list names as keys and arrays of products impressed under that list name
@property (nonatomic, strong, readonly, nullable) NSDictionary<NSString*__kindofNSSet<MPProduct*> *> *impressionsDiscussion
A dictionary containing list names as keys and arrays of products impressed under that list name
{"listName1":[product1, product2]}
Declared In
MPCommerceEvent.h
products
List of products being applied action
@property (nonatomic, strong, readonly, nullable) NSArray<MPProduct*> *productsDiscussion
List of products being applied action
Declared In
MPCommerceEvent.h
promotionContainer
@property (nonatomic, strong, nullable) MPPromotionContainer *promotionContainerSee Also
Declared In
MPCommerceEvent.h
transactionAttributes
The attributes of the transaction, such as: transactionId, tax, affiliation, shipping, etc.
@property (nonatomic, strong, nullable) MPTransactionAttributes *transactionAttributesDiscussion
The attributes of the transaction, such as: transactionId, tax, affiliation, shipping, etc.
See Also
Declared In
MPCommerceEvent.h
action
A value from the MPCommerceEventAction enum describing the commerce event action.
@property (nonatomic) MPCommerceEventAction actionDiscussion
A value from the MPCommerceEventAction enum describing the commerce event action.
Declared In
MPCommerceEvent.h
checkoutStep
The step number, within the chain of commerce event transactions, corresponding to the checkout.
@property (nonatomic) NSInteger checkoutStepDiscussion
The step number, within the chain of commerce event transactions, corresponding to the checkout.
Declared In
MPCommerceEvent.h
nonInteractive
Flag indicating whether a refund is non-interactive. The default value is false/NO.
@property (nonatomic) BOOL nonInteractiveDiscussion
Flag indicating whether a refund is non-interactive. The default value is false/NO.
Declared In
MPCommerceEvent.h
– initWithAction:product:
Initializes an instance of MPCommerceEvent with an action and a product.
- (nonnull instancetype)initWithAction:(MPCommerceEventAction)action product:(nullable MPProduct *)productParameters
action |
A value from the MPCommerceEventAction enum describing the commerce event action |
|---|---|
product |
An instance of MPProduct |
Discussion
Initializes an instance of MPCommerceEvent with an action and a product.
See Also
Declared In
MPCommerceEvent.h
– initWithImpressionName:product:
Initializes an instance of MPCommerceEvent with a list name for a product impression.
- (nonnull instancetype)initWithImpressionName:(nullable NSString *)listName product:(nullable MPProduct *)productParameters
listName |
A string under which the product was listed for this impression |
|---|---|
product |
An instance of MPProduct |
Discussion
Initializes an instance of MPCommerceEvent with a list name for a product impression.
Declared In
MPCommerceEvent.h
– initWithPromotionContainer:
Initializes an instance of MPCommerceEvent with a promotion container (promotion for products).
- (nonnull instancetype)initWithPromotionContainer:(nullable MPPromotionContainer *)promotionContainerParameters
promotionContainer |
An instance of MPPromotionContainer describing a promotion action and its respective products |
|---|
Discussion
Initializes an instance of MPCommerceEvent with a promotion container (promotion for products).
See Also
Declared In
MPCommerceEvent.h
– addImpression:listName:
Adds the representation of a product impression under a given list name.
- (void)addImpression:(nonnull MPProduct *)product listName:(nonnull NSString *)listNameParameters
product |
An instance of MPProduct |
|---|---|
listName |
A string under which the product was listed for this impression |
Discussion
Adds the representation of a product impression under a given list name.
Declared In
MPCommerceEvent.h
– allKeys
Returns an array with all keys in the custom attributes dictionary (Deprecated: use customAttributes.allKeys instead)
- (nullable NSArray *)allKeysReturn Value
An array with all keys in the custom attributes dictionary
Discussion
Returns an array with all keys in the custom attributes dictionary
Declared In
MPCommerceEvent.h
– userDefinedAttributes
A dictionary containing further information about the commerce event. The number of entries is limited to 100 key value pairs. Keys must be strings (up to 255 characters) and values can be strings (up to 4096 characters), numbers, booleans, or dates (Deprecated: use customAttributes instead)
- (NSMutableDictionary *_Nullable)userDefinedAttributesDiscussion
A dictionary containing further information about the commerce event. The number of entries is limited to 100 key value pairs. Keys must be strings (up to 255 characters) and values can be strings (up to 4096 characters), numbers, booleans, or dates
Declared In
MPCommerceEvent.h
Dictionary Methods
– dictionaryRepresentation
A Dictionary representation of this instance for uploading the event Must be overridden by a subclass
- (NSDictionary *)dictionaryRepresentationDiscussion
A Dictionary representation of this instance for uploading the event Must be overridden by a subclass
Declared In
MPBaseEvent.h
– timestamp
The timestamp when the event was created. Is non null but can be set by the client
- (NSDate *)timestampDiscussion
The timestamp when the event was created. Is non null but can be set by the client
Declared In
MPBaseEvent.h
– setTimestamp:
The timestamp when the event was created. Is non null but can be set by the client
- (void)setTimestamp:(NSDate *)timestampDiscussion
The timestamp when the event was created. Is non null but can be set by the client
Declared In
MPBaseEvent.h