Custom Events

The FeedAd SDK supports sending custom events, which allow you to track user interactions in your app, including the resulting revenue (e.g. in-app purchases).

Requirements

Integration

1. Create an Event

Using Objective-C:

// Create an event with a label only
FACustomEvent *event = [[FACustomEvent alloc] initWithLabel:@"your-event-label"];

// Create an event with revenue attached to it (e.g. 1,99 €)
NSDecimalNumber *revenue = [NSDecimalNumber decimalNumberWithMantissa:199 exponent:-2 isNegative:NO];
FACustomEvent *event = [[FACustomEvent alloc] initWithLabel:@"your-event-label" revenue:revenue revenueCurrency:@"EUR"];

Using Swift:

// Create an event with a label only
let event = FACustomEvent.init(label: "your-event-label")

// Create an event with revenue attached to it (e.g. 1,99 €)
let revenue = NSDecimalNumber.init(mantissa: 199, exponent: -2, isNegative: false)
let event = FACustomEvent.init(withLabel: "your-event-label", revenue: revenue, revenueCurrency: "EUR")

Check the class documentation inside the IDE to learn more about the event constructor parameters.

2. Send an Event

Using Objective-C:

if (![event validate]) { 
    [[FAManager sharedManager] sendCustomEvent:event];
}

Using Swift:

if let validationError = customEvent?.validate() {
    print("***** validationError = \(validationError)")
} else {
    FAManager.shared().send(customEvent)
}

An event can be sent at any time.