We have provided a list of Events with their example usage that can be integrated for Applications that belong to the mCommerce Vertical. Please find them below:

1. Purchase Event

This is used to track the Purchase transaction of the users after they have successfully completed their payment of their Purchase within your Application.

You will need to call the below method of MTractionEventTracker Class to track the In-App Purchase event in your Application.

Public static void trackPurchase(Context context, Purchase purchase);
// Product List Array Definition
List productList = new ArrayList();

// Product Constructor Call
Product product1 = new Product(productIdentifier, productName, price, quantity);

  • Mandatory parameters (Product):                
    • Product Identifier - Unique Product Identifier
    • Product Name - Name of the Product
    • Price - Price of the Product
    • Quantity - Quantity of the Product being Purchased
  • Optional parameters (Product):               
    • Brand - Brand Name of the Product
    • Product Discount - Discount applied for the Product
    • Category - Product Category
// Adding the product to the Product List
productList.add(product1);

// Purchase Constructor Call
Purchase purchase = new Purchase(userId, revenue, Purchase.PaymentMode.DEBIT_CARD, locale, transactionId, Purchase.Frequency.XXX, productList);

  • Mandatory parameters (Purchase):                
    • User Id - Unique User Identifier
    • Revenue - Total Revenue generated from this Purchase event
    • Purchase.PaymentMode.XXX - XXX can take any of the predefined values for payment methods, [CREDIT_CARD or DEBIT_CARD or NET_BANKING or GIFT_CARD or PAYMENT_WALLET]
    • Locale - Currency code used for this purchase. We can get currency code information precisely in either of the following ways:                
      1. Default from device configuration:
        Locale locale = Locale.getDefault();
        Note: Recommended for more accuracy.
      2. Custom setting:
        Locale locale = new Locale("JA"/*Language Code*/, "JP" /*Country Code*/);
        Note: Click here to view the list of Country codes (ISO-3166) & Language codes (ISO-639).
    • Transaction Id - Unique Purchase Transaction Identifier
    • Purchase.Frequency.XXX - XXX can take any of the predefined values for payment frequency, [ONCE or RECURRING] representing One Time Payment or Subscription based Payment respectively
    • Product List - Array of the list of products purchased
  • Optional parameters (Purchase):               
    • Loyalty - Loyalty points applied on the Purchase
    • Overall Discount - Discount applied for the Purchase
    • Service Charge - Service Charge applied for the Purchase
    • Location - Geolocation of the Event

Sample Code

// Example Longitude & Latitude code (Long / Lat is optional)
LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); 
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);

// Product List Array Definition
List productList = new ArrayList();

// Example Product Constructor Call with the mandatory parameters
Product product1 = new Product(“12345”, “Targus Backpack”, 29.99, 1);

// Examples for other parameters passed for the Product Class (These are optional)
product1.setBrand(“Targus”)
.setProductDiscount(5.00)
        .setCategory("Bags");

// Adding the product to the Product List
productList.add(product1);

// Example Purchase Constructor Call with the mandatory parameters
Purchase purchase= new Purchase(“123”, 29.99, Purchase.PaymentMode.DEBIT_CARD Locale.getDefault(), “1000123” , Purchase.Frequency.ONCE, productList);

// Examples for other parameters passed for the Purchase Class (These are optional)
purchase.setLoyalty(65.00)
.setOverallDiscount(5.00)
.setServiceCharge(4.99)
.setLocation(location.getLatitude(), location.getLongitude());

// trackPurchase method call
MTractionEventTracker.trackPurchase(this.getApplicationContext(), purchase);

2. Add To Cart Event

This is used to track each product added by the user to the list of items, he may be willing to purchase on the Application.

You will need to call the below method of MTractionEventTracker Class to track the Add to Cart event in your Application.

Public static void trackAddToCart(Context context, AddToCart addToCart);
AddToCart  addToCart = new AddToCart(userId, identifier, productName, category, price, locale);

  • Mandatory parameters (Add to Cart):                
    • User Id - Unique User Identifier
    • Identifier - Unique Event Identifier
    • Product Name - Name of the Product
    • Category - Product Category
    • Price - Price of the Product
    • Locale - Currency code used for this event. We can get currency code information precisely in either of the following ways:                
      1. Default from device configuration:
        Locale locale = Locale.getDefault();
        Note: Recommended for more accuracy.
      2. Custom setting:
        Locale locale = new Locale("JA"/*Language Code*/, "JP" /*Country Code*/);
        Note: Click here to view the list of Country codes (ISO-3166) & Language codes (ISO-639).
  • Optional parameters (Add to Cart):               
    • Quantity - Quantity of products added to cart
    • Brand - Brand of the product added to cart
    • Product Discount - Discount applicable for the product added to cart
    • Page Name - Page that triggered the Event
    • Location - Geolocation of the Event

Sample Code

// Example Longitude & Latitude code (Long / Lat is optional)
LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); 
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);

// Example Constructor Call with the mandatory parameters
AddToCart  addToCart = new AddToCart(“123”, ”1234567”, “Targus Backpack”, “Bags”, 29.99, Locale.getDefault());

// Examples for other parameters passed with the event (These are optional)
addToCart.setQuantity(1)
.setBrand(“Targus”)
.setProductDiscount(5.00)
.setPageName(“Product Details”)
.setLocation(location.getLatitude(), location.getLongitude());

// trackAddToCart method call
MTractionEventTracker.trackAddToCart(this.getApplicationContext(), addToCart);

3. Add To Wishlist Event

This is used to track each product added by the user to the list of his desired items, he may be willing to purchase at a later time on the Application.

You will need to call the below method of MTractionEventTracker Class to track the Add to Wishlist event in your Application.

Public static void trackAddToWishlist(Context context, AddToWishlist addToWishlist);
AddToWishlist  addToWishlist = new AddToWishlist(userId, identifier, productName, category, price, Locale);

  • Mandatory parameters (Add to Wishlist):                
    • User Id - Unique User Identifier
    • Identifier - Unique Event Identifier
    • Product Name - Name of the Product
    • Category - Product Category
    • Price - Price of the Product
    • Locale - Currency code used for this event. We can get currency code information precisely in either of the following ways:                
      1. Default from device configuration:
        Locale locale = Locale.getDefault();
        Note: Recommended for more accuracy.
      2. Custom setting:
        Locale locale = new Locale("JA"/*Language Code*/, "JP" /*Country Code*/);
        Note: Click here to view the list of Country codes (ISO-3166) & Language codes (ISO-639).
  • Optional parameters (Add to Wishlist):               
    • Brand - Brand of the product added to wishlist
    • Product Discount - Discount applicable for the product added to cart
    • Page Name - Page that triggered the Event
    • Location - Geolocation of the Event

Sample Code

// Example Longitude & Latitude code (Long / Lat is optional)
LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); 
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);

// Example Constructor Call with the mandatory parameters
AddToWishlist  addToWishlist = new AddToWishlist(“123”, ”1234567”, “Targus Backpack”, “Bags”, 29.99, Locale.getDefault());

// Examples for other parameters passed with the event (These are optional)
addToWishlist.setBrand(“Targus”)
.setProductDiscount(5.00)
.setPageName(“Product Details”)
.setLocation(location.getLatitude(), location.getLongitude());

// trackAddToWishlist method call
MTractionEventTracker.trackAddToWishlist(this.getApplicationContext(), addToWishlist);

4. Checkout Initiated Event

This is used to track the purchase initiation event before the users make their payment towards purchase in the Application.

You will need to call the below method of MTractionEventTracker Class to track the Checkout Initiated event in your Application.

Public static void trackCheckoutInitiated(Context context, CheckoutInitiated checkoutInitiated);
// Product List Array Definition
List productList = new ArrayList();

// CheckoutItem Constructor Call
CheckoutItem product = new CheckoutItem(identifier, productName, price, quantity, category);

  • Mandatory parameters (Checkout Item):                
    • Identifier - Unique Product Identifier
    • Product Name - Name of the Product
    • Price - Price of the Product
    • Quantity - Quantity of the Product being Purchased
    • Category - Product Category
  • Optional parameters (Checkout Item):               
    • Brand - Brand Name of the Product
    • Product Discount - Discount applied for the Product
// Adding the product to the Product List
productList.add(product);

// CheckoutInitiated Constructor Call
CheckoutInitiated  checkoutInitiated = new CheckoutInitiated(userId, totalPrice, Locale, productList);

  • Mandatory parameters (Checkout Initiated):                
    • User Id - Unique User Identifier
    • Total Price - Sum of the prices of the products initiated for Checkout
    • Locale - Currency code used for this purchase. We can get currency code information precisely in either of the following ways:                
      1. Default from device configuration:
        Locale locale = Locale.getDefault();
        Note: Recommended for more accuracy.
      2. Custom setting:
        Locale locale = new Locale("JA"/*Language Code*/, "JP" /*Country Code*/);
        Note: Click here to view the list of Country codes (ISO-3166) & Language codes (ISO-639).
    • productList - Array of the list of products initiated for Checkout
  • Optional parameters (Checkout Initiated):               
    • Loyalty - Loyalty points applied on the Purchase
    • Overall Discount - Discount applied for the Purchase
    • Page Name - Page that triggered the Event
    • Location - Geolocation of the Event
    • CheckoutInitiated.Payment_info_available.XXX - XXX can take either [YES or NO] depending on the availability of the user’s Payment preferences, in your Application

Sample Code

// Example Longitude & Latitude code (Long / Lat is optional)
LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); 
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);

// Product List Array Definition
List productList = new ArrayList();

// Example CheckoutItem Constructor Call with the mandatory parameters
CheckoutItem product = new CheckoutItem(“12345”, “Targus Backpack”, 29.99, 1, “Bags”);

// Examples for other parameters passed for the CheckoutItem Class (These are optional)
product.setBrand(“Targus”)
.setProductDiscount(5.00);

// Adding the product to the Product List
productList.add(product);

// Example CheckoutInitiated Constructor Call with the mandatory parameters
CheckoutInitiated  checkoutInitiated = new CheckoutInitiated(“123”, 29.99, Locale.getDefault(), productList);

// Examples for other parameters passed for the CheckoutInitiated Class (These are optional)
checkoutInitiated.setLoyalty(65.00)
.setOverallDiscount(5.00)
.setPageName(“Purchase_summary”)
.setLocation(location.getLatitude(), location.getLongitude())
.setPaymentInfoAvailable(CheckoutInitiated.Payment_info_available.YES);

// trackCheckoutInitiated method call
MTractionEventTracker.trackCheckoutInitiated(this.getApplicationContext(), checkoutInitiated);

5. Cart Abandoned Event

This is used to track the event that is triggered when the users remove products from the shopping cart within your Application.

You will need to call the below method of MTractionEventTracker Class to track the Cart Abandoned event in your Application.

Public static void trackRemoveFromCart(Context context, RemovedFromCart removedFromCart);
// Product List Array Definition
List productList = new ArrayList();

// RemovedFromCartItem Constructor Call
RemovedFromCartItem product = new RemovedFromCartItem(identifier, productName, price, quantity);

  • Mandatory parameters (Removed from Cart Item):                
    • Identifier - Unique Product Identifier
    • Product Name - Name of the Product
    • Price - Price of the Product
    • Quantity - Quantity of the Product being Purchased
  • Optional parameters (Removed from Cart Item):                
    • Brand - Brand Name of the Product
    • Product Discount - Discount applied for the Product
// Adding the product to the Product List
productList.add(product);

// RemovedFromCart Constructor Call
RemovedFromCart removedFromCart = new RemovedFromCart(userId, category, Locale, productList);

  • Mandatory parameters (Cart Abandoned):                
    • User Id - Unique User Identifier
    • Category - Product Category
    • Locale - Currency code used for this purchase. We can get currency code information precisely in either of the following ways:                
      1. Default from device configuration:
        Locale locale = Locale.getDefault();
        Note: Recommended for more accuracy.
      2. Custom setting:
        Locale locale = new Locale("JA"/*Language Code*/, "JP" /*Country Code*/);
        Note: Click here to view the list of Country codes (ISO-3166) & Language codes (ISO-639).
    • Product List - Array of the list of products initiated for Checkout
  • Optional parameters (Cart Abandoned):                
    • Page Name - Page that triggered the Event
    • Location - Geolocation of the Event

Sample Code

// Example Longitude & Latitude code (Long / Lat is optional)
LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); 
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);

// Product List Array Definition
List productList = new ArrayList();

// Example RemovedFromCartItem Constructor Call with the mandatory parameters
RemovedFromCartItem product = new RemovedFromCartItem(“12345”, “Targus Backpack”, 29.99, 1);

// Examples for other parameters passed for the RemovedFromCartItem Class (These are optional)
product.setBrand(“Targus”)
.setProductDiscount(5.00);

// Adding the product to the Product List
productList.add(product);

// Example RemovedFromCart Constructor Call with the mandatory parameters
RemovedFromCart  removedFromCart = new RemovedFromCart (“123”, “Bags”, Locale.getDefault(), productList);

// Examples for other parameters passed for the RemovedFromCart Class (These are optional)
removedFromCart.setCategory(“Bags”)
.setPageName(“Purchase_summary”)
.setLocation(location.getLatitude(), location.getLongitude());

// trackRemoveFromCart method call
MTractionEventTracker.trackRemoveFromCart(this.getApplicationContext(), removedFromCart);

6. Return Order Event

This is used to track the Return Order event triggered when an user has completed a return product request on the Application.

You will need to call the below method of MTractionEventTracker Class to track the Order Return event in your Application.

Public static void trackReturnOrder(Context context, ReturnOrder returnOrder);
ReturnOrder returnOrder = new ReturnOrder(userId, category, identifier, productName, locale, refundAmount, quantity);

  • Mandatory parameters (Return Order):                
    • Product Identifier  - Unique Product Identifier
    • Product Name - Name of the Product
    • Price - Price of the Product
    • Quantity - Quantity of the Product being Purchased
  • Optional parameters (Removed from Cart Item):                
    • Brand - Brand Name of the Product
    • Product Discount - Discount applied for the Product
    • Category  -Product Category
    • Product Model  -Product Model
    • Product.ProductState.XXX - XXX  -can take any of the predefined values [NEW or USED]


// Adding the product to the Product List
productList.add(product1);
// Return Order Constructor Call
ReturnOrder returnOrder = new ReturnOrder(userId, locale, transactionId, refundAmount, productList);
  • Mandatory parameters (Return Order):          
    • User Id - Unique User Identifier
    • Refund Amount  -Amount to be refunded for the product
    • Transaction Id  -Transaction Identifier of the order returned
    • Product List - Array of the list of products purchased
    • Locale - Currency code used for this purchase. We can get currency code information precisely in either of the following ways:          
      1. Default from device configuration:
        Locale locale = Locale.getDefault();
        Note: Recommended for more accuracy.
      2. Custom setting:
        Locale locale = new Locale("JA"/*Language Code*/, "JP" /*Country Code*/);
        Note: Click here to view the list of Country codes (ISO-3166) & Language codes (ISO-639).
    • Refund Amount - Amount to be refunded for the product
    • Quantity - Quantity of the product requested for refund
  • Optional parameters (Return Order):          
    • Page Name - Page that triggered the Event
    • Location - Geolocation of the Event

Sample Code

// Example Longitude & Latitude code (Long / Lat is optional)
LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); 
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
// Product List Array Definition
List productList = new ArrayList();

// Example Product Constructor Call with the mandatory parameters
Product product1 = new Product(“12345”, “Yearly Subscription”, 14.99, 1);

// Examples for other parameters passed for the Product Class (These are optional)
product1.setBrand(“Premium Account”)
              .setCategory("Annual Subscription") 
               .setModel(“Premium Model”)
              .setProductState(Product.ProductState.NEW);
              .setProductDiscount(5.00);

// Adding the product to the Product List
productList.add(product1);

// Example Constructor Call with the mandatory parameters
ReturnOrder returnOrder = new ReturnOrder(“123”, Locale.getDefault(),“12345”, 20.00,productList );

// Examples for other parameters passed with the event (These are optional)
.setPageName(“Track Orders”)
.setLocation(location.getLatitude(), location.getLongitude());

// trackReturnOrder method call
MTractionEventTracker.trackReturnOrder(this.getApplicationContext(), returnOrder);


7. Product Compare Event

This is used to track the product comparison event to let the users compare different products in the Application.

You will need to call the below method of MTractionEventTracker Class to track the Product Compare event in your Application.

Public static void trackProductCompared(Context context, ProductCompared productCompared);
// Product List Array Definition
List productList = new ArrayList();

// ProductComparedItem Constructor Call
ProductComparedItem product = new ProductComparedItem(identifier, productName, price);

  • Mandatory parameters (Product Compared Item):                
    • Identifier - Unique Product Identifier
    • Product Name - Name of the Product
    • Price - Price of the Product
  • Optional parameters (Product Compared Item):                
    • Brand - Brand Name of the Product
    • Product Discount - Discount applied for the Product
    • Tier - Class of Product
// Adding the product to the Product List
productList.add(product);

// ProductCompared Constructor Call
ProductCompared  productCompared = new ProductCompared(userId, productList);

  • Mandatory parameters (Product Compared):                
    • User Id - Unique User Identifier
    • Product List - Array of the list of products initiated for Checkout
  • Optional parameters (Product Compared):                
    • Category - Product Category
    • Page Name - Page that triggered the Event
    • Location - Geolocation of the Event

Sample Code

// Example Longitude & Latitude code (Long / Lat is optional)
LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); 
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);

// Product List Array Definition
List productList = new ArrayList();

// Example ProductComparedItem Constructor Call with the mandatory parameters
ProductComparedItem product = new ProductComparedItem(“12345”, “Targus Backpack”, 29.99);

// Examples for other parameters passed for the ProductComparedItem Class (These are optional)
product.setBrand(“Targus”)
       .setTier("Bags for MacBook")
       .setProductDiscount(5.00);

// Adding the product to the Product List
productList.add(product);

// Example ProductCompared Constructor Call with the mandatory parameters
ProductCompared  productCompared = new ProductCompared(“123”, productList);

// Examples for other parameters passed for the ProductCompared Class (These are optional)
productCompared.setCategory(“Bags”)
.setPageName(“Compare Products”)
.setLocation(location.getLatitude(), location.getLongitude());

// trackProductCompared method call
MTractionEventTracker.trackProductCompared(this.getApplicationContext(), productCompared);