iOS - Reporting User Activity

Report User Activity

You can report intermediate steps in the checkout funnel for analytics and measurement purposes, including:

  • Product Views
  • Add To Cart
  • Cart Views

This is achieved by first creating a Product, and then reporting it to the Merchant Library.

/// Create product item
let product = ButtonProduct()
product.id = "abc123"
product.upc = "012345678901"
product.categories = ["Electronics", "Televisions"]
product.name = "Flatscreen TV"
product.currency = "USD"
product.value = 39999
product.quantity = 1
product.url = "https://yourbrand.com/p/tv123"
product.attributes = ["size": "40 inch"]

/// Report a product view
ButtonMerchant.activity.productViewed(product)

/// Report a product added to the cart
ButtonMerchant.activity.productAddedToCart(product)

/// Report a cart view
ButtonMerchant.activity.cartViewed([product, otherProduct])
/// Create product item
ButtonProduct *product = [[ButtonProduct alloc] init];
product.id = @"abc123";
product.upc = @"012345678901";
product.categories = @[@"Electronics", @"Televisions"];
product.name = @"Flatscreen TV";
product.currency = @"USD";
product.value = @39999;
product.quantity = @1;
product.url = @"https://yourbrand.com/p/tv123";
product.attributes = @{@"size": @"40 inch"};

/// Report a product view
[[ButtonMerchant activity] productViewed:product];

/// Report a product added to the cart
[[ButtonMerchant activity] productAddedToCart:product];

/// Report a cart view
[[ButtonMerchant activity] cartViewed:@[product, otherProduct]];

Note: You can pass your own product object by implementing the protocol ButtonProductCompatible on your product class.