dusanmiha

Facebook App - Ecommerce - Android - Java - InitiatedCheckout Event

Oct 14th, 2021
797
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * This function assumes logger is an instance of AppEventsLogger and has been
  3.  * created using AppEventsLogger.newLogger() call.
  4.  */
  5. public void logInitiatedCheckoutEvent (String contentId, String contentType, int numItems, boolean paymentInfoAvailable, String currency, double totalPrice) {
  6.     Bundle params = new Bundle();
  7.     params.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, contentId);                             //product identifier. String.
  8.     params.putString(AppEventsConstants.EVENT_PARAM_CONTENT_TYPE, contentType);                         //'product' or 'product_group'. String.
  9.     params.putInt(AppEventsConstants.EVENT_PARAM_NUM_ITEMS, numItems);                                  //Number of items. Integer.
  10.     params.putInt(AppEventsConstants.EVENT_PARAM_PAYMENT_INFO_AVAILABLE, paymentInfoAvailable ? 1 : 0); //1 for yes, 0 for no
  11.     params.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, currency);                                //ISO 4217 code, e.g., "EUR", "RSD"..string.
  12.     logger.logEvent(AppEventsConstants.EVENT_NAME_INITIATED_CHECKOUT, totalPrice, params);
  13. }
RAW Paste Data