Skip to content

Commit 469188a

Browse files
authored
Merge pull request #28 from AppsFlyerSDK/dev/sdk-v6-beta
Dev/sdk v6 beta
2 parents c8cf3c1 + a14bfde commit 469188a

File tree

50 files changed

+1695
-1364
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1695
-1364
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# OS X
22
.DS_Store
33

4+
#IntelliJ
5+
6+
.idea
7+
48
# Xcode
59
build/
610
*.pbxuser

HISTORY.md

Whitespace-only changes.

README.md

Lines changed: 85 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<img src="https://www.appsflyer.com/wp-content/uploads/2016/11/logo-1.svg" width="200">
22

33
# AppsFlyer integration for Segment.
4-
This is a Segment wrapper for AppsFlyer SDK framework.
4+
5+
## This is a Segment wrapper for AppsFlyer SDK that is built with iOS SDK v6.0.2.
56

67

78
----------
8-
In order for us to provide optimal support, we would kindly ask you to submit any issues to [email protected]
9+
🛠 In order for us to provide optimal support, we would kindly ask you to submit any issues to [email protected]
910

1011
*When submitting an issue please specify your AppsFlyer sign-up (account) email , your app ID , production steps, logs, code snippets and any additional relevant information.*
1112

@@ -15,7 +16,6 @@ In order for us to provide optimal support, we would kindly ask you to submit an
1516
## Table of content
1617

1718
- [Installation](#installation)
18-
1919
- [Usage](#usage)
2020
- [Objective-C](#usage-obj-c)
2121
- [Swift](#usage-swift)
@@ -31,20 +31,28 @@ In order for us to provide optimal support, we would kindly ask you to submit an
3131

3232
### Cocoapods
3333

34-
To install the segment-appsflyer-ios integration, simply add this line to your [CocoaPods](http://cocoapods.org) `Podfile`:
34+
To install the segment-appsflyer-ios integration:
35+
36+
1. Simply add this line to your [CocoaPods](http://cocoapods.org) `Podfile`:
3537

38+
**Production** version:
3639
```ruby
3740
pod 'segment-appsflyer-ios'
3841
```
3942

43+
44+
2. Run `pod isntall` in the project directory
45+
4046
### Carthage
4147

4248
[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate AppsFlyer and Segment into your Xcode project using Carthage, specify it in your `Cartfile`:
4349

50+
**Production** version:
4451
```ogdl
45-
github "AppsFlyerSDK/segment-appsflyer-ios" "5.1.3"
52+
github "AppsFlyerSDK/segment-appsflyer-ios" "6.0.2"
4653
```
4754

55+
4856
## <a id="usage"> Usage
4957

5058
First of all, you must provide values for AppsFlyer Dev Key, Apple App ID (iTunes) and client secret in Segment's **dashboard** for AppsFlyer integration
@@ -60,49 +68,90 @@ Open `AppDelegate.h` and add:
6068
In `AppDelegate.m``didFinishLaunchingWithOptions`:
6169

6270
```objective-c
63-
SEGAnalyticsConfiguration *config = [SEGAnalyticsConfiguration configurationWithWriteKey:@"SEGMENT_KEY"];
64-
65-
[config use:[SEGAppsFlyerIntegrationFactory instance]]; // this line may need to be replaced if you would like to get conversion and deep link data in the app.
71+
72+
// For ApsFlyer debug logs
73+
[AppsFlyerLib shared].isDebug = YES;
74+
75+
// If you want to collect IDFA, please add the code below and read https://support.appsflyer.com//hc/en-us/articles/207032066#integration-35-support-apptrackingtransparency-att
76+
if (@available(iOS 14, *)) {
77+
[[AppsFlyerLib shared] waitForAdvertisingIdentifierWithTimeoutInterval:60];
78+
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
79+
//....
80+
}];
81+
}
82+
/*
83+
Based on your needs you can either pass a delegate to process deferred
84+
and direct deeplinking callbacks or disregard them.
85+
If you choose to use the delegate, see extension to this class below
86+
*/
87+
SEGAppsFlyerIntegrationFactory* factoryNoDelegate = [SEGAppsFlyerIntegrationFactory instance];
88+
// SEGAppsFlyerIntegrationFactory* factoryWithDelegate = [SEGAppsFlyerIntegrationFactory createWithLaunchDelegate:self];
6689

90+
SEGAnalyticsConfiguration *config = [SEGAnalyticsConfiguration configurationWithWriteKey:@"WYsuyFINOKZuQyQAGn5JQoCgIdhOI146"];
91+
[config use:factoryNoDelegate];
92+
// [config use:factoryWithDelegate]; // use this if you want to get conversion data in the app. Read more in the integration guide
6793
config.enableAdvertisingTracking = YES; //OPTIONAL
6894
config.trackApplicationLifecycleEvents = YES; //OPTIONAL
6995
config.trackDeepLinks = YES; //OPTIONAL
7096
config.trackPushNotifications = YES; //OPTIONAL
71-
config.trackAttributionData = YES; //OPTIONAL
97+
config.trackAttributionData = YES; //OPTIONAL
7298
[SEGAnalytics debug:YES]; //OPTIONAL
7399
[SEGAnalytics setupWithConfiguration:config];
74100
```
75101
76102
### <a id="usage-swift"> Usage - Swift
77103
78-
Open/Create `<Your-App-name>-Bridging-Header.h` and add:
104+
1. Open/Create `<Your-App-name>-Bridging-Header.h` and add:
79105
80106
```objective-c
81107
#import "SEGAppsFlyerIntegrationFactory.h"
82108
```
109+
![image](https://user-images.githubusercontent.com/50541317/90022182-e5768900-dcba-11ea-8bfd-180cc6f28700.png)
83110

84-
Open `AppDelegate.swift``didFinishLaunchingWithOptions` and add:
111+
2. Add path to the Bridging header under Build Settings > Swift Compiler - General > Objective-C Bridging Header
112+
![image](https://user-images.githubusercontent.com/50541317/90022174-e1e30200-dcba-11ea-8785-0303aebe75e2.png)
85113

86-
```swift
114+
3. Open `AppDelegate.swift` and add:
87115

116+
```swift
88117
import Analytics
89-
90-
//...
91-
92-
let config:Analytics.SEGAnalyticsConfiguration = SEGAnalyticsConfiguration(writeKey: "SEGMENT_KEY")
93-
94-
config.use(SEGAppsFlyerIntegrationFactory()) // this line may need to be replaced if you would like to get conversion and deep link data in the app.
95-
config.enableAdvertisingTracking = true //OPTIONAL
96-
config.trackApplicationLifecycleEvents = true //OPTIONAL
97-
config.trackDeepLinks = true //OPTIONAL
98-
config.trackPushNotifications = true //OPTIONAL
99-
config.trackAttributionData = true //OPTIONAL
100-
101-
Analytics.SEGAnalytics.debug(true)
102-
Analytics.SEGAnalytics.setup(with: config)
118+
import AppsFlyerLib
103119
```
104120

121+
4. In `didFinishLaunchingWithOptions` add:
122+
```
123+
// For AppsFLyer debug logs uncomment the line below
124+
// AppsFlyerLib.shared().isDebug = true
125+
126+
// If you want to collect IDFA, please add the code below and read https://support.appsflyer.com//hc/en-us/articles/207032066#integration-35-support-apptrackingtransparency-att
127+
if #available(iOS 14, *) {
128+
AppsFlyerLib.shared().waitForAdvertisingIdentifier(withTimeoutInterval: 60)
129+
ATTrackingManager.requestTrackingAuthorization(completionHandler: { (status) in
130+
// ...
131+
})
132+
}
105133
134+
/*
135+
Based on your needs you can either pass a delegate to process deferred
136+
and direct deeplinking callbacks or disregard them.
137+
If you choose to use the delegate, see extension to this class below
138+
*/
139+
// let factoryWithDelegate : SEGAppsFlyerIntegrationFactory = SEGAppsFlyerIntegrationFactory.create(withLaunch: self)
140+
let factoryNoDelegate = SEGAppsFlyerIntegrationFactory()
141+
142+
// Segment initialization
143+
let config = AnalyticsConfiguration(writeKey: "SEGMENT_KEY")
144+
// config.use(factoryWithDelegate) // use this if you want to get conversion data in the app. Read more in the integration guide
145+
config.use(factoryNoDelegate)
146+
config.enableAdvertisingTracking = true //OPTIONAL
147+
config.trackApplicationLifecycleEvents = true //OPTIONAL
148+
config.trackDeepLinks = true //OPTIONAL
149+
config.trackPushNotifications = true //OPTIONAL
150+
config.trackAttributionData = true //OPTIONAL
151+
152+
Analytics.debug(false)
153+
Analytics.setup(with: config)
154+
```
106155

107156
AppsFlyer integration responds to ```identify``` call. To read more about it, visit [Segment identify method documentation](https://segment.com/docs/libraries/ios/#identify).
108157
In identify call ```traits``` dictionary ```setCustomerUserID``` and ```currencyCode```
@@ -118,15 +167,15 @@ In identify call ```traits``` dictionary ```setCustomerUserID``` and ```currenc
118167

119168
In order to get Conversion Data you need to:
120169

121-
1. Add `SEGAppsFlyerTrackerDelegate` protocol to your AppDelegate.h (or other) class
170+
1. Add `SEGAppsFlyerLibDelegate` protocol to your AppDelegate.h (or other) class
122171
```
123172
#import <UIKit/UIKit.h>
124173
#import "SEGAppsFlyerIntegrationFactory.h"
125174
126-
@interface AppDelegate : UIResponder <UIApplicationDelegate, SEGAppsFlyerTrackerDelegate>
175+
@interface AppDelegate : UIResponder <UIApplicationDelegate, SEGAppsFlyerLibDelegate>
127176
```
128177
2. Pass AppDelegate (or other) class when configuring Segment Analytics with AppsFlyer. Change line `[config use:[SEGAppsFlyerIntegrationFactory instance]];` to `[config use:[SEGAppsFlyerIntegrationFactory createWithLaunchDelegate:self]];`
129-
3. In the class passed to the method above (AppDelegate.m by default) implement methods of the `SEGAppsFlyerTrackerDelegate` protocol. See sample code below:
178+
3. In the class passed to the method above (AppDelegate.m by default) implement methods of the `SEGAppsFlyerLibDelegate` protocol. See sample code below:
130179

131180
```
132181
#import "AppDelegate.h"
@@ -186,12 +235,12 @@ In identify call ```traits``` dictionary ```setCustomerUserID``` and ```currenc
186235

187236
In order to get Conversion Data you need to:
188237

189-
1. Add `SEGAppsFlyerTrackerDelegate` protocol to your AppDelegate (or other) class
190-
2. Pass AppDelegate (or other) class when configuring Segment Analytics with AppsFlyer. Change line `config.use(SEGAppsFlyerIntegrationFactory())` to `config.use(SEGAppsFlyerIntegrationFactory.create(withLaunch: self))`
191-
3. Implement methods of the protocol. See sample code below:
238+
1. Add `SEGAppsFlyerLibDelegate` protocol to your AppDelegate (or other) class
239+
2. Pass AppDelegate (or other) class when configuring Segment Analytics with AppsFlyer. If you use sample code from above, change line `config.use(factoryNoDelegate)` to `config.use(factoryWithDelegate)`
240+
3. Implement methods of the protocol in the class, passed as a delegate. See sample code below where AppDelegate is used for that:
192241

193242
```
194-
class AppDelegate: UIResponder, UIApplicationDelegate, SEGAppsFlyerTrackerDelegate {
243+
class AppDelegate: UIResponder, UIApplicationDelegate, SEGAppsFlyerLibDelegate {
195244
196245
var window: UIWindow?
197246
@@ -263,11 +312,11 @@ If you are working with networks that don't allow passing user level data to 3rd
263312
/// To set Apple App ID and AppsFlyer Dev Key use Segment dashboard
264313
/// ...
265314
/// Enable ESP support for specific URLs
266-
[[AppsFlyerTracker sharedTracker] setResolveDeepLinkURLs:@[@"afsdktests.com"]];
315+
[[AppsFlyerLib shared] setResolveDeepLinkURLs:@[@"afsdktests.com"]];
267316
/// Disable printing SDK messages to the console log
268-
[[AppsFlyerTracker sharedTracker] setIsDebug:NO];
317+
[[AppsFlyerLib shared] setIsDebug:NO];
269318
/// `OneLink ID` from OneLink configuration
270-
[[AppsFlyerTracker sharedTracker] setAppInviteOneLink:@"one_link_id"];
319+
[[AppsFlyerLib shared] setAppInviteOneLink:@"one_link_id"];
271320
}
272321
}
273322
```

RELEASENOTES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release Notes
22

3+
### 6.0.2
4+
* Updated iOS SDK to v6.0.2
5+
6+
### 6.0.1-beta
7+
* Updated iOS SDK to v6.0.1
8+
39
### 5.4.0
410
* Updated iOS SDK to v5.4.0
511
* Removed analytics version pinning

0 commit comments

Comments
 (0)