Skip to content

Commit a8949a4

Browse files
authored
Merge pull request #75 from AppsFlyerSDK/DELIVERY-39499/updateTov6.12.0&v6.12.1
added 3 apis + remove old android dependencies and updated docs
2 parents 2fe202f + d38027c commit a8949a4

11 files changed

Lines changed: 758 additions & 319 deletions

File tree

README.md

Lines changed: 7 additions & 308 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010

1111
- [Supported Platforms](#this-plugin-is-built-for)
1212
- [Installation](#installation)
13-
- [API Methods](#api-methods)
14-
- [initSdk](#initSdk)
15-
- [logEvent](#logEvent)
16-
- [deepLink](#deepLink)
17-
- [Set plugin for IOS 14](#ios14)
18-
- [setSharingFilter](#setSharingFilter)
19-
- [setSharingFilterForAllPartners](#setSharingFilterForAllPartners)
13+
- [Integration](#api-methods)
14+
- [initSdk](#initSdk)
15+
- [logEvent](#logEvent)
16+
- [Set plugin for IOS 14](docs/ios14.md)
17+
- [deepLink](docs/deeplink.md)
18+
- [APIs](/docs/api.md)
2019
- [Demo](#demo)
2120

2221

@@ -37,7 +36,7 @@ Android: deepLinkResult will return an object instead of a string
3736

3837

3938

40-
## <a id="api-methods"> API Methods
39+
## <a id="Integration"> Integration
4140

4241
---
4342

@@ -131,307 +130,7 @@ to measure the ROI (Return on Investment) and LTV (Lifetime Value).
131130

132131

133132
```
134-
---
135-
136-
---
137-
138-
## <a id="deeplinking"> Deep Linking
139-
<img src="https://massets.appsflyer.com/wp-content/uploads/2018/03/21101417/app-installed-Recovered.png" width="350">
140-
141-
142-
#### The 3 Deep Linking Types:
143-
Since users may or may not have the mobile app installed, there are 2 types of deep linking:
144-
145-
1. Deferred Deep Linking - Serving personalized content to new or former users, directly after the installation.
146-
2. Direct Deep Linking - Directly serving personalized content to existing users, which already have the mobile app installed.
147-
3. Unified deep linking - Unified deep linking sends new and existing users to a specific in-app activity as soon as the app is opened.
148-
149-
For more info please check out the [OneLink™ Deep Linking Guide](https://support.appsflyer.com/hc/en-us/articles/208874366-OneLink-Deep-Linking-Guide#Intro).
150-
151-
### <a id="deferred-deep-linking"> 1. Deferred Deep Linking (Get Conversion Data)
152-
153-
Handle the Deferred deeplink in the following callback:
154-
```
155-
var options = {
156-
157-
onConversionDataSuccess: function(_res){
158-
console.log("Get conversion data success: " + JSON.stringify(_res));
159-
},
160-
}
161-
```
162-
163-
Check out the deferred deeplinkg guide from the AppFlyer knowledge base [here](https://support.appsflyer.com/hc/en-us/articles/207032096-Accessing-AppsFlyer-Attribution-Conversion-Data-from-the-SDK-Deferred-Deeplinking-#Introduction)
164-
165-
### <a id="handle-deeplinking"> 2. Direct Deeplinking
166-
167-
Handle the Direct deeplink in the 'onAppOpenAttribution' callback:
168-
169-
```
170-
var options = {
171-
devKey: 'devKey',
172-
appId: "appId",
173-
isDebug: true,
174-
onAppOpenAttribution: function(_res){
175-
console.log("onAppOpenAttribution: " + JSON.stringify(_res));
176-
},
177-
onAppOpenAttributionFailure: function(_res){
178-
console.log("onAppOpenAttributionFailure: " + JSON.stringify(_res));
179-
},
180-
};
181-
```
182-
183-
When a deeplink is clicked on the device the AppsFlyer SDK will return the link in the [onAppOpenAttribution](https://support.appsflyer.com/hc/en-us/articles/208874366-OneLink-Deep-Linking-Guide#deep-linking-data-the-onappopenattribution-method-) method.
184-
185-
### <a id="Unified-deep-linking"> 3. Unified deep linking
186-
187-
Handle the Unified deeplink in the 'onDeepLinking' callback (if `onDeepLinking` callback is define, `onAppOpenAttribution` won't be called):
188-
189-
```
190-
var options = {
191-
devKey: 'devKey',
192-
appId: "appId",
193-
isDebug: true,
194-
onDeepLinking: function(_res){
195-
console.log("onDeepLinking: " + _res);
196-
},
197-
};
198-
199-
For more information about this api, please check [OneLink Guide Here](https://dev.appsflyer.com/docs/android-unified-deep-linking)
200-
201-
### <a id="android-deeplink"> Android Deeplink Setup
202-
203-
204-
#### URI Scheme
205-
In your app’s manifest add the following intent-filter to your relevant activity:
206-
```xml
207-
<intent-filter>
208-
<action android:name="android.intent.action.VIEW" />
209-
<category android:name="android.intent.category.DEFAULT" />
210-
<category android:name="android.intent.category.BROWSABLE" />
211-
<data android:scheme="your unique scheme" />
212-
</intent-filter>
213-
```
214-
215-
**NOTE:** On Android, AppsFlyer SDK inspects activity intent object during onResume(). Because of that, for each activity that may be configured or launched with any [non-standard launch mode](https://developer.android.com/guide/topics/manifest/activity-element#lmode) the following code was added to `MainActivity.java` in `android/app/src/main/java/com...`
216-
217-
Java:
218-
219-
```java
220-
@Override
221-
public void onNewIntent(Intent intent) {
222-
super.onNewIntent(intent);
223-
setIntent(intent);
224-
}
225-
```
226-
227-
Kotlin:
228-
229-
```
230-
override fun onNewIntent(intent : Intent){
231-
super.onNewIntent(intent)
232-
setIntent(intent)
233-
}
234-
```
235-
236-
237-
#### App Links
238-
239-
In your app’s manifest add the following intent-filter to your relevant activity:
240-
241-
```xml
242-
<intent-filter android:autoVerify="true">
243-
<action android:name="android.intent.action.VIEW" />
244-
<category android:name="android.intent.category.DEFAULT" />
245-
<category android:name="android.intent.category.BROWSABLE" />
246-
<data android:scheme="your unique scheme" />
247-
<data android:scheme="https"
248-
android:host="yourcompany.onelink.me"
249-
android:pathPrefix="your path prefix" />
250-
</intent-filter>
251-
```
252-
253-
For more on App Links check out the guide [here](https://support.appsflyer.com/hc/en-us/articles/115005314223-Deep-Linking-Users-with-Android-App-Links#what-are-android-app-links).
254-
255-
256-
### <a id="iosdeeplinks"> iOS Deeplink Setup
257-
258-
259-
### URI Scheme
260-
261-
1. Create custom app delegate
262-
263-
2. Add the following iOS method and AppsFlyer API
264-
265-
```
266-
@NativeClass()
267-
export class CustomAppDelegate extends UIResponder, ATTrackingManager implements UIApplicationDelegate{
268-
public static ObjCProtocols = [UIApplicationDelegate];
269-
270-
applicationOpenURLOptions(application: UIApplication, urlOptions: NSURL, options: NSDictionary<string, any>): boolean {
271-
console.log("applicationOpenURLOptions");
272-
AppsFlyerLib.shared().handleOpenUrlOptions(urlOptions, options);
273-
return true;
274-
}
275-
276-
// Open URI-scheme for iOS 8 and below
277-
applicationOpenURLSourceApplicationAnnotation(application: UIApplication, url: NSURL, sourceApplication: string, annotation: any): boolean {
278-
console.log("applicationOpenURLSourceApplicationAnnotation");
279-
AppsFlyerLib.shared().handleOpenURLSourceApplicationWithAnnotation(url, sourceApplication, annotation);
280-
return true;
281-
}
282-
};
283-
284-
```
285-
286-
For more on URI-schemes check out the guide [here](https://support.appsflyer.com/hc/en-us/articles/208874366-OneLink-deep-linking-guide#setups-uri-scheme-for-ios-8-and-below)
287-
288-
289-
### Universal Links
290-
291-
1. Create custom app delegate
292-
293-
2. Add the following iOS method and AppsFlyer API
294-
295-
```
296-
@NativeClass()
297-
export class CustomAppDelegate extends UIResponder, ATTrackingManager implements UIApplicationDelegate{
298-
public static ObjCProtocols = [UIApplicationDelegate];
299-
300-
// Open Universal Links
301-
applicationContinueUserActivityRestorationHandler?(application: UIApplication, userActivity: NSUserActivity, restorationHandler: (p1: NSArray<UIUserActivityRestoring>) => void): boolean{
302-
console.log("applicationContinueUserActivityRestorationHandler");
303-
AppsFlyerLib.shared().continueUserActivityRestorationHandler(userActivity, restorationHandler);
304-
return true;
305-
}
306-
};
307-
```
308-
309133

310-
311-
More on Universal Links:
312-
Essentially, the Universal Links method links between an iOS mobile app and an associate website/domain, such as AppsFlyer’s OneLink domain (xxx.onelink.me). To do so, it is required to:
313-
314-
1. Get your SHA256 fingerprint:
315-
316-
a. Creating A Keystore
317-
318-
b. [Generate Fingerprint](https://developers.google.com/android/guides/client-auth)
319-
2. Configure OneLink sub-domain and link to mobile app in the AppsFlyer onelink setup on your dashboard, add the fingerprint there (AppsFlyer takes care of hosting the ‘apple-app-site-association’ file)
320-
3. Configure the mobile app to register approved domains:
321-
322-
```xml
323-
<?xml version="1.0" encoding="UTF-8"?>
324-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
325-
<plist version="1.0">
326-
<dict>
327-
<key>com.apple.developer.associated-domains</key>
328-
<array>
329-
<string>applinks:test.onelink.me</string>
330-
</array>
331-
</dict>
332-
</plist>
333-
```
334-
335-
For more on Universal Links check out the guide [here](https://support.appsflyer.com/hc/en-us/articles/208874366-OneLink-Deep-Linking-Guide#setups-universal-links).
336-
337-
338-
---
339-
340-
## <a id="ios14"> Set plugin for IOS 14
341-
342-
1. Add a custom App Delegate and inside add the ATT consent dialog for IDFA collection:
343-
```
344-
@NativeClass()
345-
export class CustomAppDelegate extends UIResponder, ATTrackingManager implements UIApplicationDelegate{
346-
public static ObjCProtocols = [UIApplicationDelegate];
347-
348-
applicationDidFinishLaunchingWithOptions(application: UIApplication, launchOptions: NSDictionary): boolean {
349-
if (parseFloat(UIDevice.currentDevice.systemVersion) >= 14) {
350-
console.log("iOS 14");
351-
ATTrackingManager.requestTrackingAuthorizationWithCompletionHandler((status) => {
352-
353-
});
354-
}
355-
console.log("applicationDidFinishLaunchingWithOptions");
356-
}
357-
358-
};
359-
```
360-
361-
2. In the app.ts add:
362-
363-
```
364-
import { CustomAppDelegate } from "./custom-app-delegate";
365-
366-
if (Application.ios) {
367-
Application.ios.delegate = CustomAppDelegate;
368-
}
369-
```
370-
371-
3. Add `Privacy - Tracking Usage Description` inside your `.plist` file in Xcode.
372-
373-
4. Optional: Set the `timeToWaitForATTUserAuthorization` property in the `options` to delay the sdk initazliation for a number of `x seconds` until the user accept the consent dialog:
374-
375-
```
376-
var options = {
377-
devKey: 'WdpTVAcYwmxsaQ4WeTspmh',
378-
appId: "975313579",
379-
isDebug: true,
380-
timeToWaitForATTUserAuthorization: 60
381-
};
382-
```
383-
384-
385-
For more info visit our Full Support guide for iOS 14:
386-
387-
https://support.appsflyer.com/hc/en-us/articles/207032066#integration-33-configuring-app-tracking-transparency-att-support
388-
389-
390-
---
391-
##`Sharing filter`
392-
(GDPR/CCPA COMPLIANT - Read more information in the [following article](https://support.appsflyer.com/hc/en-us/articles/360001422989-Implementing-app-user-opt-in-opt-out-in-the-AppsFlyer-SDK)
393-
394-
In some cases, advertisers may want to stop sharing user-level data with ad networks/partners for specific users.
395-
Reasons for this include:
396-
Privacy policies such as CCPA or GDPR
397-
User opt-out mechanisms
398-
Competition with some partners (ad networks, 3rd parties)
399-
AppsFlyer provides two API methods to stop sharing data with some or all partners:
400-
401-
402-
#####<a id="setSharingFilter"> **`appsFlyer.setSharingFilter(partners): Promise<any>`**
403-
- `setSharingFilter`: Used by advertisers to set some (one or more) networks/integrated partners to exclude from getting data.
404-
405-
| parameter | type | description |
406-
| ----------- |-----------------------------|--------------|
407-
| `partners` | `Array` | Exclude (one or more) networks/integrated partners from getting data |
408-
409-
410-
*Example: (native javascript)*
411-
412-
```javascript
413-
var partners = [""];
414-
415-
appsFlyer.setSharingFilter(partners).then(function(result) {
416-
viewModel.set("setSharingFilterResponse", result.status);
417-
}, function(err) {
418-
viewModel.set("setSharingFilter Response", JSON.stringify(err));
419-
});
420-
```
421-
422-
#####<a id="setSharingFilterForAllPartners"> **`appsFlyer.setSharingFilterForAllPartners(): Promise<any>`**
423-
- `setSharingFilterForAllPartners`: Used by advertisers to exclude all networks/integrated partners from getting data.
424-
425-
*Example: (native javascript)*
426-
427-
```javascript
428-
appsFlyer.setSharingFilterForAllPartners().then(function(result) {
429-
viewModel.set("setSharingFilterForAllPartners", result.status);
430-
}, function(err) {
431-
viewModel.set("setSharingFilterForAllPartners Response", JSON.stringify(err));
432-
});
433-
```
434-
---
435134
##Demo
436135

437136
This plugin has a `demo` project bundled with it. To give it a try , clone this repo and from root a.e. `nativescript-plugin-appsflyer` execute the following:

0 commit comments

Comments
 (0)