ALEventService.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //
  2. // ALEventService.h
  3. // AppLovinSDK
  4. //
  5. // Created by Thomas So on 2/13/19
  6. // Copyright © 2020 AppLovin Corporation. All rights reserved.
  7. //
  8. NS_ASSUME_NONNULL_BEGIN
  9. /**
  10. * Service that tracks various analytical events.
  11. */
  12. @interface ALEventService : NSObject
  13. /**
  14. * Sets a super property that this service will record with all future events.
  15. *
  16. * If @c superProperty is @c nil, this method will remove the super property with key @c key from being recorded with all future events.
  17. *
  18. * @param superProperty The value to assign to the super property whose key is @c key. Valid types include @c NSString, @c NSNumber, @c NSSDate, @c NSURL,
  19. * @c NSArray, and @c NSDictionary. Set this to @c nil to remove the super property whose key is @c key from being recorded with all future
  20. * events.
  21. * @param key The key that identifies the the super property whose value this method sets.
  22. */
  23. - (void)setSuperProperty:(nullable id)superProperty forKey:(NSString *)key;
  24. /**
  25. * NSDictionary that represents the currently-set super properties that this services records with events.
  26. */
  27. @property (nonatomic, copy, readonly) NSDictionary<NSString *, id> *superProperties;
  28. /**
  29. * Tracks an event without adding supplemental data.
  30. *
  31. * AppLovin recommends that you use one of the predefined strings provided in ALEventTypes.h for the event name, when those strings apply to the event.
  32. *
  33. * @param eventName A string that represents the event to track.
  34. */
  35. - (void)trackEvent:(NSString *)eventName;
  36. /**
  37. * Tracks an event and adds supplemental data.
  38. *
  39. * AppLovin recommends that you use one of the predefined strings provided in ALEventTypes.h for the event name and parameter keys, when those strings
  40. * apply to the event.
  41. *
  42. * @param eventName A string that represents the event to track.
  43. * @param parameters A dictionary that contains key-value pairs that further describe this event.
  44. */
  45. - (void)trackEvent:(NSString *)eventName parameters:(nullable NSDictionary<NSString *, id> *)parameters;
  46. /**
  47. * Tracks an in-app purchase.
  48. *
  49. * AppLovin recommends that you use one of the predefined strings provided in ALEventTypes.h for the parameter keys, when one of those strings applies
  50. * to the event. At a minimum, provide the following parameters: @c kALEventParameterProductIdentifierKey, @c kALEventParameterRevenueAmountKey, and
  51. * @c kALEventParameterRevenueCurrencyKey. If you pass a value for @c kALEventParameterStoreKitReceiptKey, AppLovin will use that value for validation.
  52. * Otherwise, AppLovin will collect @code +[NSBundle mainBundle] @endcode ⇒ @code -[NSBundle appStoreReceiptURL] @endcode and use it for validation.
  53. *
  54. * @param transactionIdentifier Value of the @code -[SKTransaction transactionIdentifier] @endcode property.
  55. * @param parameters A dictionary that contains key-value pairs that further describe this event.
  56. */
  57. - (void)trackInAppPurchaseWithTransactionIdentifier:(NSString *)transactionIdentifier parameters:(nullable NSDictionary<NSString *, id> *)parameters;
  58. /**
  59. * Tracks a checkout / standard purchase.
  60. *
  61. * AppLovin recommends that you use one of the predefined strings provided in ALEventTypes.h for the parameter keys, when one of those strings applies to the
  62. * event. At a minimum, provide the following parameters: @c kALEventParameterProductIdentifierKey, @c kALEventParameterRevenueAmountKey, and
  63. * @c kALEventParameterRevenueCurrencyKey.
  64. *
  65. * @param transactionIdentifier An optional unique identifier for this transaction, generated by you. For Apple Pay transactions, AppLovin suggests that you use
  66. * the value of the @code -[PKPaymentToken transactionIdentifier] @endcode property.
  67. * @param parameters A dictionary that contains key-value pairs that further describe this event.
  68. */
  69. - (void)trackCheckoutWithTransactionIdentifier:(nullable NSString *)transactionIdentifier parameters:(nullable NSDictionary<NSString *, id> *)parameters;
  70. - (instancetype)init NS_UNAVAILABLE;
  71. + (instancetype)new NS_UNAVAILABLE;
  72. @end
  73. NS_ASSUME_NONNULL_END