|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectcom.amazonaws.mobileconnectors.amazonmobileanalytics.monetization.MonetizationEventBuilder
com.amazonaws.mobileconnectors.amazonmobileanalytics.monetization.CustomMonetizationEventBuilder
public class CustomMonetizationEventBuilder
Builds monetization events representing a purchase from an IAP framework not defined by a specific builder. The store attribute must be set by the user. This Builder will return null if the Store, ProductId, Quantity, and either the Formatted Localized Price or Price and Currency are not set.
The example below demonstrates how to create a monetization event after you receive a purchase confirmation from the IAP framework you are using. You are responsible for storing and making sure that the bare minimum attributes required to build a Custom Purchase Event are available for use at this time. Note that the builder will maintain the values of its internal variables between builds.
Example:
// get the event client from your MobileAnalyticsManager instance
EventClient eventClient = mobileAnalyticsManager.getEventClient();
// create a builder that can record purchase events for the IAP Framework you are using
CustomMonetizationEventBuilder builder = CustomMonetizationEventBuilder.create(eventClient);
// build the monetization event with at minimum the store, product id, quantity, and price information
// The price information can be supplied in either of the following ways:
// - The price as a double (i.e. 1.99) and the currency as a currency code (i.e. "USD"). This method is preferred as it provides more accuracy in the monetization reports
// - The formatted localized price of the item as a string (i.e. "$1.99")
// You may also build with any additional available attributes that the IAP Framework provides such as Transaction ID
// Price and currency
Event purchaseEvent = builder.withStore("Custom Store").withProductId("com.yourgame.sword").withItemPrice(1.99).withCurrency("USD").withQuantity(1).build();
// Formatted Price
purchaseEvent = builder.withStore("Custom Store").withProductId("com.yourgame.sword").withFormattedItemPrice("$1.99").withQuantity(1).build();
// record the monetization event
eventClient.recordEvent(purchaseEvent);
| Method Summary | |
|---|---|
static CustomMonetizationEventBuilder |
create(EventClient eventClient)
Create a CustomMonetizationEventBuilder with the specified Event client |
CustomMonetizationEventBuilder |
withCurrency(java.lang.String currency)
Sets the currency of the item being purchased (Required if formatted localized price is not specified) |
CustomMonetizationEventBuilder |
withFormattedItemPrice(java.lang.String formattedItemPrice)
Sets the formatted localized price of the item being purchased (Required if numerical price and currency are not specified) |
CustomMonetizationEventBuilder |
withItemPrice(double itemPrice)
Sets the numerical price of the item being purchased (Required if formatted localized price is not specified) |
CustomMonetizationEventBuilder |
withProductId(java.lang.String productId)
Sets the product identifier field of the item being purchased (Required) |
CustomMonetizationEventBuilder |
withQuantity(java.lang.Double quantity)
Sets the quantity of the item being purchased (Required) |
CustomMonetizationEventBuilder |
withStore(java.lang.String store)
Sets the store in which the transaction is taking place (Required) |
CustomMonetizationEventBuilder |
withTransactionId(java.lang.String transactionId)
The transaction identifier of the purchase (Optional) |
| Methods inherited from class com.amazonaws.mobileconnectors.amazonmobileanalytics.monetization.MonetizationEventBuilder |
|---|
build |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static CustomMonetizationEventBuilder create(EventClient eventClient)
eventClient - The event client to use when creating monetization events
public CustomMonetizationEventBuilder withStore(java.lang.String store)
store - The store in which the transaction is taking place
public CustomMonetizationEventBuilder withProductId(java.lang.String productId)
productId - The product id representing the item being purchased
public CustomMonetizationEventBuilder withQuantity(java.lang.Double quantity)
quantity - The quantity of the item being purchased
public CustomMonetizationEventBuilder withFormattedItemPrice(java.lang.String formattedItemPrice)
formattedItemPrice - The formatted localized price of the item
public CustomMonetizationEventBuilder withItemPrice(double itemPrice)
itemPrice - The numerical price of the item
public CustomMonetizationEventBuilder withCurrency(java.lang.String currency)
currency - The currency code of the currency used to purchase this item (i.e. "USD")
public CustomMonetizationEventBuilder withTransactionId(java.lang.String transactionId)
transactionId - The transaction id of the purchase
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||