Collecting Order Cancel Events for Accurate Sales Performance Measurement

    To accurately measure sales performance, you must collect data not only on completed purchases but also on canceled purchases, as returns and refunds can significantly impact the final numbers.

     

    Collecting Order Cancel Events

    The Order Cancel event is one of the Standard Events provided by Airbridge. This event can be viewed in the Actuals Report and the raw data export files.

    An Order Complete event must always precede an Order Cancel event. Several data points must match between the Order Complete and Order Cancel events to accurately calculate net revenue. For example, the product price of the canceled purchase must match the product price of the completed purchase that preceded it.

    Mapping order cancel events and order complete events

    To make sure both the Order Purchase event and the Order Cancel event have the same information, you need to map them. This means adding the Order Purchase event's Transaction ID as the Transaction ID of the Order Cancel event.

    Refer to the sample code below.

    1234567891011121314151617181920
    airbridge.events.send("airbridge.ecommerce.order.canceled", {
      semanticAttributes: {
        transactionID: '1458132a-0d09-4944-a686-fcbee81b74f7',
        transactionPairedEventTimestamp: 1599186193324,
        totalValue: 99000,
        products: [{
          productID: "1234",
          name: "Nike 1",
          price: 55000,
          currency: "KRW",
          quantity: 1
        }, {
          productID: "1235",
          name: "Nike 2",
          price: 44000,
          currency: "KRW",
          quantity: 1
        }]
      }
    });
    123456789101112131415161718192021
    Map < String, Object > product1 = new HashMap < > ();
    product1.put("productID", "1234");
    product1.put("name", "Nike 1");
    product1.put("price", 55000);
    product1.put("currency", "KRW");
    product1.put("quantity", 1);
    Map < String, Object > product2 = new HashMap < > ();
    product1.put("productID", "1235");
    product1.put("name", "Nike 2");
    product1.put("price", 44000);
    product1.put("currency", "KRW");
    product1.put("quantity", 1);
    List < Map < String, Object >> products = new ArrayList < > ();
    products.add(product1);
    products.add(product2);
    Map < String, Object > semanticAttributes = new HashMap < > ();
    semanticAttributes.put("transactionID", "1458132a-0d09-4944-a686-fcbee81b74f7");
    semanticAttributes.put("transactionPairedEventTimestamp", 1599186193324 L);
    semanticAttributes.put("totalValue", 99000);
    semanticAttributes.put("product", products);
    Airbridge.trackEvent("airbridge.ecommerce.order.canceled", // Category null, // Action null, // Label null, // Value null, // Custom Attributes semanticAttributes // Semantic Attributes );
    123456789101112131415161718192021222324252627282930
    Airbridge.trackEvent(
      category = "airbridge.ecommerce.order.canceled",
      semanticAttributes =
        mapOf(
          "transactionID" to "1458132a-0d09-4944-a686-fcbee81b74f7",
          "transactionPairedEventTimestamp" to 1599186193324L,
          "totalValue" to 99000,
          "products" to
            mapOf(
              "totalValue" to 99000,
              "product" to
                listOf(
                  mapOf(
                    "productID" to "1234",
                    "name" to "Nike 1",
                    "price" to 55000,
                    "currency" to "KRW",
                    "quantity" to 1
                  ),
                  mapOf(
                    "productID" to "1235",
                    "name" to "Nike 2",
                    "price" to 44000,
                    "currency" to "KRW",
                    "quantity" to 1
                  )
              )
           )
        )
    )
    1234567891011121314151617181920212223
    #import <AirBridge / ABInAppEvent.h>
    ABInAppEvent * event = [[ABInAppEvent alloc] init];
    [event setCategory: @ "airbridge.ecommerce.order.canceled"];
    NSDictionary * semantics = @ {
      @"transactionID": @"1458132a-0d09-4944-a686-fcbee81b74f7",
      @"transactionPairedEventTimestamp": @1599186193324,
      @"totalValue": @99000,
      @ "products": @[@{
        @"productID": @"1234",
        @"name": @"Nike 1",
        @"price": @55000,
        @"currency": @"KRW",
        @"quantity": @1,
      }, @{
        @"productID": @"1235",
        @"name": @"Nike 2",
        @"price", @44000,
        @"currency": @"KRW",
        @"quantity": @1,
      }],
    };
    [event setSemantics: semantics];
    [event send];
    12345678910111213141516171819202122232425
    let event = ABInAppEvent ()
    event?.setCategory ("airbridge.ecommerce.order.canceled")
    let semantics : [String: Any]= [
      "transactionID" : "1458132a-0d09-4944-a686-fcbee81b74f7",
      "transactionPairedEventTimestamp" : 1599186193324,
      "totalValue" : 99000,
      "products" : [
        [
          "productID" : "1234",
          "name" : "Nike 1",
          "price" : 55000,
          "currency" : "KRW",
          "quantity" : 1,
        ],
        [
          "productID" : "1235",
          "name" : "Nike 2",
          "price" : 44000,
          "currency" : "KRW",
          "quantity" : 1,
        ]
      ]
    ]
    event?.setSemantics (semantics)
    event?.send ()

    The semantic attribute of the Order Cancel event is as follows.

    Configure the semantic attributes of the Order Cancel Event as follows.

    Attribute

    Type

    Description

    transactionID

    string

    The Transaction ID of the Order Complete event

    transactionPairedEventTimestamp

    int

    The date and time the Order Complete event occurred (13-digit Unix Timestamp)

    totalValue

    float

    The canceled purchase amount (refund amount)

    totalQuantity

    int

    The total product quantity of the canceled purchase

    currency

    string

    The currency of the canceled purchase amount

    productListID

    string

    The product list ID of the canceled purchase

    products.$0.productID

    string

    The product ID of the canceled purchase

    products.$0.name

    string

    The product name of the canceled purchase

    products.$0.price

    float

    The product price of the canceled purchase

    products.$0.currency

    string

    The currency of the product price for the canceled purchase

    products.$0.quantity

    int

    The number of products of the canceled purchase

     

    How to view actual sales performance

    Navigate to the [Raw Data]menu and export Order Complete and Order Cancel event data. By organizing this data according to Transaction ID, you can view the actual sales performance. By visualizing the actual sales performance by channel, you can see the channel-specific sales performance, excluding canceled purchases.

    Applying to Other Events

    Cancellations of bookings also impact performance. Defining and collecting cancellation events is crucial for accurate performance measurement. A cancellation event registers when a previous event is canceled.

    Defining Cancellation Events

    A cancellation event registers when a prior event is canceled. For example, a booking cancellation event occurs when a booking event that has been collected is canceled.

    You can define cancellation events as Custom Events. Set the semantic attributes of the Custom Event as follows:

    • semanticAttributes.transactionType: Set to "cancel"

    • semanticAttributes.transactionPairedEventCategory: Set to the category of the event being canceled (e.g., "booking")

    Order Cancel events are Standard Events and require no additional configuration. Their semantic attributes are set as follows:

    • semanticAttributes.transactionType: "cancel"

    • semanticAttributes.transactionPairedEventCategory: The category of the completed purchase event (airbridge.ecommerce.order.completed)

    Refer to the sample code below.

    12345678
    airbridge.events.send("reservation_cancel", {
      semanticAttributes: { 
        transactionID: '1458132a-0d09-4944-a686-fcbee81b74f7', 
        transactionType: 'cancel', 
        transactionPairedEventCategory: 'reservation', 
        transactionPairedEventTimestamp: 1599186193324,
      },
    });

    Attribution rules for cancellation events

    An Airbridge event is considered a cancellation event if it meets at least one of the following conditions:

    • It is a purchase cancellation event (airbridge.ecommerce.order.canceled).

    • It has "cancel" set as the value of semanticAttributes.transactionType.

    The Airbridge attribution modelalways measures cancellation events as having no winning touchpoint. The cancellation events are always displayed as "unattributed" in the Airbridge reports.

    Was this helpful?

    Any questions or suggestions?