Skip to content

Commit

Permalink
added details on how to create custom events
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Espinola committed Jul 12, 2024
1 parent e383cc9 commit 298db37
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 298db37

Please sign in to comment.