From 298db370d77a3e3e629ada7ed3ba2b56da566a35 Mon Sep 17 00:00:00 2001 From: Vladimir Espinola Date: Fri, 12 Jul 2024 17:01:30 -0400 Subject: [PATCH] added details on how to create custom events --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 46e0ebc..5cc983d 100644 --- a/README.md +++ b/README.md @@ -249,7 +249,24 @@ ATTNAddToCartEvent* addToCart = [[ATTNAddToCartEvent alloc] initWithItems:items ATTNProductViewEvent* productView = [[ATTNProductViewEvent alloc] initWithItems:items]; productView.deeplink = @"https://mydeeplink.com/products/32432423"; [[ATTNEventTracker sharedInstance] recordEvent:productView]; +``` + +The SDK allows custom events to be sent using `ATTNCustomEvent,` where type is the event name and the properties is a dictionary(`[String: String]`) with the information to populate the message to the subscribers dynamically. + +#### Swift + +```swift +// ☝️ Init can return nil if there are issues with the provided data in properties +guard let customEvent = ATTNCustomEvent(type: "Concert Viewed", properties: ["band": "Myrath"]) else { return } +ATTNEventTracker.sharedInstance()?.record(event: customEvent) +``` + +#### Objective-C + +```objective-c +ATTNCustomEvent* customEvent = [[ATTNCustomEvent alloc] initWithType:@"Concert Viewed" properties:@{@"band" : @"Myrath"}]; +[[ATTNEventTracker sharedInstance] recordEvent:customEvent]; ``` ### Switch to another domain