AWSMobileAnalyticsMonetizationEventBuilder

Objective-C

@interface AWSMobileAnalyticsMonetizationEventBuilder : NSObject

Swift

class AWSMobileAnalyticsMonetizationEventBuilder : NSObject

Base class for handling the required attributes and metrics for monetization Events. This class is not meant to be instantiated. Instead, create instances specific to the purchase you are trying to record. Currently, AWSMobileAnalyticsVirtualMonetizationEventBuilder is used to create monetization events for virtual purchases, and AWSMobileAnalyticsAppleMonetizationEventBuilder is used to create monetization events for purchases with Apple’s IAP framework.

This class can be extended if you need to record monetization events from other purchase frameworks. Derived classes must override the AWSMobileAnalyticsMonetizationEventBuilder::isValid method so that AWSMobileAnalyticsMonetizationEventBuilder knows if the derived builder is in a valid state.

  • Builds an AWSMobileAnalyticsEvent using the current state of the builder. @returns an AWSMobileAnalyticsEvent or nil, if the builder is in an invalid state

    Declaration

    Objective-C

    - (id<AWSMobileAnalyticsEvent>)build;

    Swift

    func build() -> AWSMobileAnalyticsEvent!
  • Determines if this builder is in a valid state. This method must be overridden in derived classes. @returns YES if the Builder is valid, NO otherwise.

    Declaration

    Objective-C

    - (BOOL)isValid;

    Swift

    func isValid() -> Bool
  • Initializes the AWSMobileAnalyticsMonetizationEventBuilder. This class is not meant to be initialized directly. This method should only be called/overridden by derived builders.

    Declaration

    Objective-C

    - (id)initWithEventClient:(id<AWSMobileAnalyticsEventClient>)theEventClient;

    Swift

    init!(eventClient theEventClient: AWSMobileAnalyticsEventClient!)
  • The product id that will be used to build the monetization event @returns The product id

    Declaration

    Objective-C

    - (NSString *)productId;

    Swift

    func productId() -> String!
  • Sets the product id to use when building the monetization event

    Declaration

    Objective-C

    - (void)setProductId:(NSString *)theProductId;

    Swift

    func setProductId(_ theProductId: String!)

    Parameters

    theProductId

    the product id of the item being purchased

  • The quantity that will be used to build the monetization event @returns The quantity of items purchased

    Declaration

    Objective-C

    - (NSInteger)quantity;

    Swift

    func quantity() -> Int
  • Sets the quantity to use when building the monetization event

    Declaration

    Objective-C

    - (void)setQuantity:(NSInteger)theQuantity;

    Swift

    func setQuantity(_ theQuantity: Int)

    Parameters

    theQuantity

    the quantity of the item being purchased

  • The numerical price of the item being purchased that will be used to build the monetization event @returns The numerical item price

    Declaration

    Objective-C

    - (double)itemPrice;

    Swift

    func itemPrice() -> Double
  • Sets the numerical item price to use when building the monetization event

    Declaration

    Objective-C

    - (void)setItemPrice:(double)theItemPrice;

    Swift

    func setItemPrice(_ theItemPrice: Double)

    Parameters

    theItemPrice

    the price of the item being purchased

  • The formatted item price that will be used to build the monetization event @returns The item price formatted with its currency

    Declaration

    Objective-C

    - (NSString *)formattedItemPrice;

    Swift

    func formattedItemPrice() -> String!
  • Sets the formatted item price in its local currency to use when building the monetization event

    Declaration

    Objective-C

    - (void)setFormattedItemPrice:(NSString *)theFormattedItemPrice;

    Swift

    func setFormattedItemPrice(_ theFormattedItemPrice: String!)

    Parameters

    theFormattedItemPrice

    the formatted item price in its local currency

  • The transaction id that will be used to build the monetization event @returns The transaction id

    Declaration

    Objective-C

    - (NSString *)transactionId;

    Swift

    func transactionId() -> String!
  • Sets the transaction id to use when building the monetization event

    Declaration

    Objective-C

    - (void)setTransactionId:(NSString *)theTransactionId;

    Swift

    func setTransactionId(_ theTransactionId: String!)

    Parameters

    theTransactionId

    the transaction id of the purchase

  • The currency that be used to build the monetization event @returns The currency

    Declaration

    Objective-C

    - (NSString *)currency;

    Swift

    func currency() -> String!
  • Sets the currency of the item price to use when building the monetization event

    Declaration

    Objective-C

    - (void)setCurrency:(NSString *)theCurrency;

    Swift

    func setCurrency(_ theCurrency: String!)

    Parameters

    theCurrency

    the ISO currency code or virtual curreny name of the item price

  • The name of the Store where this purchase was made. For example “Apple” for purchases originating from the Apple IAP Store, or “Virtual” if the purchase was performed in your in-game store. @returns The store of the purchase

    Declaration

    Objective-C

    - (NSString *)store;

    Swift

    func store() -> String!
  • Sets the name of the Store to use when building the monetization event

    Declaration

    Objective-C

    - (void)setStore:(NSString *)theStore;

    Swift

    func setStore(_ theStore: String!)

    Parameters

    theStore

    the store where the purchase originated from (i.e. “Apple” or “Virtual”)