The Standard Events API was designed taking into consideration industry standard app events. MOCA Supports the following:
- User Login - Enables you to identify a user and register user sessions by tracking login and logout events.
- View History - By adding the item ID and, optionally, the category to the call, this method records this view events in the view collection within the current user profile.
- Favourites List - You can easily manage user favourites by easily adding, removing or clearing the list. The separate favlist is maintained per each user, including an anonymous user.
- Wish List - With methods for adding to wishlist, removing from wishlist and clearing the wishlist, you can easily track the main actions associated to wishlists. Currently only one wishlist per user is supported, including an anonymous user.
- Shopping Cart - Composed of adding, removing, clearing, checkout begin and checkout completed actions you can track the shopping cart lifecycle of a current user.
- Purchase History - Like the above, but this is focused on tracking purchases when a shopping cart isn’t implemented.
- Shared items - By adding the item ID and, optionally, the category to the call, this method tracks the share event in the user profile.
- Content Rating - By adding the item ID and, optionally, the category and the rating to the call, this method records the content rating event in the user profile.
The Standard Events API is part of the iOS 2.6.0 MOCA SDK.
Track an item viewed by current user. Requires unique item identifier, optional category string and recommended flag. Mark recommended = true flag only when the item was recommended to the user by the App, for all other scenarios user recommended = false.
[MOCA trackViewed:@"itemID" belongingTo:@"category"] [MOCA trackViewed:@"itemID" belongingTo:@"category" withReco:false]
- Track an item added/removed to Favourites List of the current user or clear the list.
[MOCA addToFavList:@"itemID"] [MOCA removeFromFavList:@"itemID"] [MOCA clearFavList]
- Track/remove items from user Wishlist or clear it
[MOCA addToWishList:@"itemID"] [MOCA removeFromWishList:@"itemID"] [MOCA clearWishList]
Create cart item. The item represents a product that can be purchased. Cart is persistent which means it will preserve its content after restarting the App.
MOCAItem* item = [MOCA createItem:@"itemID" belongingTo:@"category" withUnitPrice:@75.0 withCurrency:@"EUR"]
- itemId - unique item identifier. Item represents a product with unique ID, belongs to a category, is associated unitary price and currency
- category - item category (optional)
- unitPrice - unitary price for the item, expressed in currency
- currency - price currency, 3-letter ISO code or virtual currency name
Add/update/remove item to/from cart. You may add one or multiple items to the cart. Each item will be represented as cart line object. Cart line object contains the item and the quantity of that item. Given that item has a unique identifier adding the same item multiple times via this call will result in adding the added quantities.
[MOCA addToCart:item withQuantity:@3] [MOCA updateCart:@"itemID" withQuantity:@5] [MOCA removeFromCart:@"itemID"] [MOCA clearCart]
Begin checkout of the cart and Complete Checkout. This indicates the user has started the checkout process with the intention of the making the purchase. Once completed, execute completeCheckout.
[MOCA beginCheckout] [MOCA completeCheckout]
Example of MOCA Cart usage:
// create item sku-123 object MOCAItem* item123 = [MOCA createItem:@"sku-123" belongingTo:@"Food" withUnitPrice:@75.0 withCurrency:@"AED"]; // 2 unit of item sku-123 added to cart [MOCA addToCart:item123 withQuantity:@2]; // update quantity to 3 units [MOCA updateCart:item123 withQuantity:@3]; // begin checkout [MOCA beginCheckout]; ... // purchase completed [MOCA completeCheckout];
Purchase history can be tracked even if the App doesn't support a Cart object.
[MOCA trackPurchased:@"itemID" belongingTo:@"category" withUnitPrice:@75.0 withCurrency:@"AED" withQuantity:@5] [MOCA trackPurchased:item123 withQuantity:@5]
Track item or content shared by current user:
Track user based ratings:
[MOCA trackContentRated:@"itemID" belongingTo:@"category" withRating:@4.0] [MOCA trackContentRated:@"itemID" withRating:@4.0]
Track user login/logout: Login call restores all user profile related data to previous session. Logout restores an anonymous user profile.
[[MOCA currentInstance] login:@"userId"] [[MOCA currentUser] logout]