Skip to content

Commit

Permalink
Merge pull request #113 from vespinola/feature/update-readme
Browse files Browse the repository at this point in the history
Update README
  • Loading branch information
Vladimir Espinola Lezcano authored Jul 15, 2024
2 parents a0612bd + 42f339c commit aabeef1
Showing 1 changed file with 53 additions and 8 deletions.
61 changes: 53 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ ATTNEventTracker.setup(with: sdk)

#### Objective-C

```objectiveC
```objective-c
#import "ATTNSDKFramework-Swift.h"
#import "ATTNSDKFramework-umbrella.h"
```

```objectiveC
```objective-c

ATTNSDK *sdk = [[ATTNSDK alloc] initWithDomain:@"myCompanyDomain"];

Expand All @@ -117,7 +117,7 @@ sdk.identify([

#### Objective-C

```objectiveC
```objective-c
[sdk identify:@{
ATTNIdentifierType.clientUserId: @"myAppUserId",
ATTNIdentifierType.phone: @"+15556667777"
Expand Down Expand Up @@ -162,7 +162,7 @@ sdk.trigger(view) { status in

#### Objective-C

```objectiveC
```objective-c
// Load the creative with a completion handler.
[sdk trigger:self.view
handler:^(NSString *triggerStatus) {
Expand All @@ -186,7 +186,7 @@ sdk.trigger(view)

#### Objective-C

```objectiveC
```objective-c
[sdk trigger:self.view];
```
Expand Down Expand Up @@ -214,7 +214,7 @@ ATTNEventTracker.sharedInstance().record(event: purchase)

#### Objective-C

```objectiveC
```objective-c
ATTNItem* item = [[ATTNItem alloc] initWithProductId:@"222" productVariantId:@"55555" price:[[ATTNPrice alloc] initWithPrice:[[NSDecimalNumber alloc] initWithString:@"15.99"] currency:@"USD"]];

ATTNOrder* order = [[ATTNOrder alloc] initWithOrderId:@"778899"];
Expand All @@ -223,6 +223,51 @@ ATTNPurchaseEvent* purchase = [[ATTNPurchaseEvent alloc] initWithItems:@[item] o

[[ATTNEventTracker sharedInstance] recordEvent:purchase];
```
---
For `ATTNProductViewEvent` and `ATTNAddToCartEvent,` you can include a `deeplink` in the init method or the property to incentivize the user to complete a specific flow.
#### Swift
```swift
// Init method
let addToCart = ATTNAddToCartEvent(items: items, deeplink: "https://mydeeplink.com/products/32432423")
ATTNEventTracker.sharedInstance()?.record(event: addToCart)
// Property
let productView = ATTNProductViewEvent(items: items)
productView.deeplink = "https://mydeeplink.com/products/32432423"
ATTNEventTracker.sharedInstance()?.record(event: productView)
```

#### Objective-C
```objective-c
// Init Method
ATTNAddToCartEvent* addToCart = [[ATTNAddToCartEvent alloc] initWithItems:items deeplink:@"https://mydeeplink.com/products/32432423"];
[[ATTNEventTracker sharedInstance] recordEvent:addToCart];

// Property
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 dynamic content in the message to subscribers.
#### 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 All @@ -237,7 +282,7 @@ sdk.update(domain: "differentDomain")

#### Objective-C

```objectivec
```objective-c
ATTNSDK *sdk = [[ATTNSDK alloc] initWithDomain:@"domain"];
[sdk updateDomain: @"differentDomain"];
```
Expand Down Expand Up @@ -276,7 +321,7 @@ sdk.clearUser()

#### Objective-C

```objectiveC
```objective-c
[sdk clearUser];
```

Expand Down

0 comments on commit aabeef1

Please sign in to comment.