Tracking Events
Track custom events as shown below.
using WebEngageBridge;
...
// Track simple event
WebEngage.TrackEvent("Product - Page Viewed");
// Track event with attributes
Dictionary<string, object> orderPlacedAttributes = new Dictionary<string, object>();
orderPlacedAttributes.Add("Amount", 808.48);
orderPlacedAttributes.Add("Product 1 SKU Code", "UHUH799");
orderPlacedAttributes.Add("Product 1 Name", "Armani Jeans");
orderPlacedAttributes.Add("Product 1 Price", 300.49);
orderPlacedAttributes.Add("Product 1 Size", "L");
orderPlacedAttributes.Add("Product 2 SKU Code", "FBHG746");
orderPlacedAttributes.Add("Product 2 Name", "Hugo Boss Jacket");
orderPlacedAttributes.Add("Product 2 Price", 507.99);
orderPlacedAttributes.Add("Product 2 Size", "L");
orderPlacedAttributes.Add("Delivery Date", System.DateTime.ParseExact("2017-10-21 09:27:37.100", "yyyy-MM-dd hh:mm:ss.fff", null));
orderPlacedAttributes.Add("Delivery City", "San Francisco");
orderPlacedAttributes.Add("Delivery ZIP", "94121");
orderPlacedAttributes.Add("Coupon Applied", "BOGO17");
WebEngage.TrackEvent("Order Placed", orderPlacedAttributes);
// Track complex event
Dictionary<string, object> product1 = new Dictionary<string, object>();
product1.Add("SKU Code", "UHUH799");
product1.Add("Product Name", "Armani Jeans");
product1.Add("Price", 300.49);
Dictionary<string, object> detailsProduct1 = new Dictionary<string, object>();
detailsProduct1.Add("Size", "L");
product1.Add("Details", detailsProduct1);
Dictionary<string, object> product2 = new Dictionary<string, object>();
product2.Add("SKU Code", "FBHG746");
product2.Add("Product Name", "Hugo Boss Jacket");
product2.Add("Price", 507.99);
Dictionary<string, object> detailsProduct2 = new Dictionary<string, object>();
detailsProduct2.Add("Size", "L");
product2.Add("Details", detailsProduct2);
Dictionary<string, object> deliveryAddress = new Dictionary<string, object>();
deliveryAddress.Add("City", "San Francisco");
deliveryAddress.Add("ZIP", "94121");
Dictionary<string, object> orderPlacedAttributes = new Dictionary<string, object>();
List<object> products = new List<object>();
products.Add(product1);
products.Add(product2);
List<string> coupons = new List<string>();
coupons.Add("BOGO17");
orderPlacedAttributes.Add("Products", products);
orderPlacedAttributes.Add("Delivery Address", deliveryAddress);
orderPlacedAttributes.Add("Coupons Applied", coupons);
WebEngage.TrackEvent("Order Placed", orderPlacedAttributes);
Note: WebEngage SDK only supports the following data-types: string, bool, int, long, float, double, DateTime, List and Dictionary.
Updated over 5 years ago
So, what's next?