AWSMobileAnalyticsVirtualMonetizationEventBuilder

Objective-C

@interface AWSMobileAnalyticsVirtualMonetizationEventBuilder
    : AWSMobileAnalyticsMonetizationEventBuilder

Swift

class AWSMobileAnalyticsVirtualMonetizationEventBuilder : AWSMobileAnalyticsMonetizationEventBuilder

AWSMobileAnalyticsVirtualMonetizationEventBuilder builds monetization events to track virtual purchases from your In-Game store. In order to build a Virtual monetization event, you must call all of the setters on this builder.

The example below shows how to record a monetization event for the purchase of 1 sword that costs 500 Gold.

id eventClient = insights.eventClient;

// create a builder that can record purchase events from your In-Game Store AWSMobileAnalyticsVirtualMonetizationEventBuilder* builder = [AWSMobileAnalyticsVirtualMonetizationEventBuilder builderWithEventClient:eventClient];

// set the product id of the purchased item [builder withProductId:@“com.yourgame.sword”];

// set the item price [builder withItemPrice:500];

// set the currency of the item price [builder withCurrency:@“Gold”];

// set the quantity of item(s) purchased [builder withQuantity:1];

// build/record the monetization event id virtualPurchaseEvent = [builder build]; [eventClient recordEvent:virtualPurchaseEvent];

  • Create a monetization builder that can record purchase events from your In-Game Store

    Declaration

    Objective-C

    + (AWSMobileAnalyticsVirtualMonetizationEventBuilder *)builderWithEventClient:
        (id<AWSMobileAnalyticsEventClient>)theEventClient;

    Parameters

    theEventClient

    The event client used to create the event @returns a monetization event builder for In-Game store purchases

  • Sets the product id for the item(s) being purchased

    Declaration

    Objective-C

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

    Swift

    func withProductId(_ theProductId: String!)

    Parameters

    theProductId

    The product id of the item(s) being purchased

  • Sets the item price of the item being purchased

    Declaration

    Objective-C

    - (void)withItemPrice:(double)theItemPrice;

    Swift

    func withItemPrice(_ theItemPrice: Double)

    Parameters

    theItemPrice

    The numerical item price

  • Sets the quantity of item(s) being purchased.

    Declaration

    Objective-C

    - (void)withQuantity:(NSInteger)theQuantity;

    Swift

    func withQuantity(_ theQuantity: Int)

    Parameters

    theQuantity

    The quantity of items purchased

  • Sets the currency of the item price

    Declaration

    Objective-C

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

    Swift

    func withCurrency(_ theCurrency: String!)

    Parameters

    theCurrency

    The currency of the item price

  • Builds the monetization event using the parameters set on the builder. You must still record the event. @returns an AWSMobileAnalyticsEvent to record

    Declaration

    Objective-C

    - (id<AWSMobileAnalyticsEvent>)build;

    Swift

    func build() -> AWSMobileAnalyticsEvent!