# Product Events

Product events capture e-commerce activity - what contacts browse, add to cart, purchase, and more. They use a predefined set of event types so your data maps cleanly to Positive User's commerce reports.


# Send a product event

UserSDK.default?.sendProductEvent(
    "SKU-1234",
    eventType: .purchase,
    name: "Running Shoes",
    productURL: "https://example.com/shoes/1234",
    params: [
        "price": 89.99,
        "currency": "USD",
        "size": "42"
    ]
) { success, error in
    if let error {
        // handle error
    }
}

Only productId and eventType are required. All other parameters are optional:

UserSDK.default?.sendProductEvent("SKU-1234", eventType: .view)

# Event types

Case Sent as
.addToCart "add to cart"
.purchase "purchase"
.liking "liking"
.addToObservation "add to observation"
.order "order"
.reservation "reservation"
.return "return"
.view "view"
.click "click"
.detail "detail"
.add "add"
.remove "remove"
.checkout "checkout"
.checkoutOption "checkout option"
.refund "refund"
.promoClick "promo click"

# Parameters

Parameter Type Required
productId String Yes
eventType EventType Yes
name String? No
productURL String? No
params [String: Any]? No