Registering for Analytics

Initializing Analytics

To have VenueNext events reported to your preferred analytics tool, first create an object that conforms to the AnalyticsInterface (See documentation here). The interface contains several functions that are called when events are triggered in the SDK:

By Use case

Post Purchase Analytics

Post purchase analytics can be tracked in the track(eventType: Event, metadata: Bundle) function. For post purchase analytics captured by this function, the eventType will be ECOMMERCE_PURCHASE and the metadata will contain more info about the purchase, such as the price, order UUID, and item names.

By Method Signature

fun trackScreenView(activity: Activity, screenName: String)
  • Triggered each time a user views a screen in the SDK (docs)
fun trackUserId(userId: String?)
  • Triggered during SDK initialization when a user has been identified (docs)
  • Note: If you want to ensure this event is captured, make sure to add your AnalyticsInterface before initializing the SDK
fun trackMenuItemSelection(itemId: String, itemName: String, itemCategory: String, variant: String, price: Double)
  • Triggered when a user taps on an item being displayed in a Menu (docs)
  • For Food and Beverage menus, this will provide the base price of an item
  • For Experience menus, prices may vary based on which Event the user has selected:
    • If the user has selected an event, the price of the item relative to that event will be provided
    • If the user has not selected an event, the price of the item relative to the next event where the Experience is available will be provided
fun trackAddToCart(itemId: String, itemName: String, itemCategory: String, variant: String, price: Double, quantity: Long)
  • Triggered when a user adds an item to their Cart
  • For Food and Beverage menus, this will provide the base price of an item
  • For Experience menus, currently this event will not be triggered - this will be updated in a future release
fun trackRemoveFromCart(itemId: String, itemName: String, itemCategory: String, variant: String, price: Double, quantity: Long)
  • Triggered when a user removes an individual item from their cart at Checkout (docs)
fun trackAddsPaymentType(paymentType: String, cardType: String)
  • Triggered when an order is placed (docs)
  • Will be triggered once for each payment method used to complete an order
    • Passes a paymentType of “credit card” for credit card payments and cardType that corresponds to the card’s company (“MasterCard”, “Visa”, etc)
    • Passes a paymentType of “vn_bank” or “magic_money” and a cardType of “none” for virtual currency payment types (which paymentType value is passed depends on your environment - check your config JSON file for the vc_bank_name to see which value you can expect)
fun trackBeginCheckout(items: ArrayList<Bundle>)
  • Triggered when a user enters the Checkout screen (docs)
  • Each item will be represented by a Bundle that uses values in the Param enum seen here as keys
    • Each key an exact string representation of the value in the Param enum - e.g. ITEM_NAME -> “ITEM_NAME”
  • Expected values in each Bundle in the items parameter:
    • ITEM_ID - UUID of the menu item
    • ITEM_NAME - name of the menu item
    • ITEM_CATEGORY - category of the menu item
    • ITEM_VARIANT - SKU of the menu item
    • PRICE - base price of the menu item
    • CURRENCY - currency abbreviation (usually “USD”)
    • QUANTITY - number of this menu item in the cart
fun trackCheckoutProgress(items: ArrayList<Bundle>, orderState: String)
  • Triggered at several points (docs):
    • Once, when the user completes a purchase at Checkout
    • Every time the order state changes while the user is viewing the Receipt
  • Each item will be represented by a Bundle that uses values in the Param enum seen here as keys
    • Each key an exact string representation of the value in the Param enum - e.g. ITEM_NAME -> “ITEM_NAME”
  • Expected values in each Bundle in the items parameter:
    • ITEM_ID - UUID of the menu item
    • ITEM_NAME - name of the menu item
    • PRICE - base price of the menu item
    • CURRENCY - currency abbreviation (usually “USD”)
    • QUANTITY - number of this menu item in the cart
fun trackPurchase(items: ArrayList<Bundle>, transactionId: String, affiliation: String, value: Double, tax: Double, shipping: Double)
  • Triggered once, when the user’s order state has been updated to a successful final state (docs)
  • Each item will be represented by a Bundle that uses values in the Param enum seen here as keys
    • Each key an exact string representation of the value in the Param enum - e.g. ITEM_NAME -> “ITEM_NAME”
  • Expected values in each Bundle in the items parameter:
    • ITEM_ID - UUID of the menu item
    • ITEM_NAME - name of the menu item
    • PRICE - base price of the menu item
    • CURRENCY - currency abbreviation (usually “USD”)
    • QUANTITY - number of this menu item in the cart

Adding Your AnalyticsInterface

Once you’ve created your AnalyticsInterface, pass an instance of it to the VenueNext object via the following API:

VenueNext.configureAnalytics(MyAnalyticsInterface())

It is recommended to implement the AnalyticsInterface as seen in the VNAnalytics class in the Android SDK Demo App repository. Using this implementation as-is will ensure that events are reported in the same format as iOS out of the box.

See the implementation here.

Updated: