SDK Migration - Cordova-Ionic SDK

This article contains the information required to update the Airbridge Cordova-Ionic SDK. We recommend checking the information regarding all versions.

Update from v2.x to v4.0

Check the information below when updating the Airbridge Cordova-Ionic SDK to v4.0.

List of all changes

SDK installation and initialization

The key values of airbridge.json have been changed. Change the key values as follows.

airbridge.json (v2)

airbridge.json (v4)

trackingAuthorizeTimeoutSeconds

autoDetermineTrackingAuthorizationTimeoutInSecond

facebookDeferredAppLinkEnabled

trackMetaDeferredAppLinkEnabled

sessionTimeoutSeconds

sessionTimeoutInSecond

metaInstallReferrer

metaInstallReferrerAppID

trackAirbridgeLinkOnly

trackAirbridgeDeeplinkOnlyEnabled

userInfoHashEnabled

hashUserInformationEnabled

sdkSignatureSecretID

sdkSignatureID

sdkSignatureSecret

sdkSignatureSecret

iOS

The AirbridgeCO.getInstance function in iOS has been replaced with the AirbridgeCordova.initializeSDK function. Modify the ios/YOUR_PROJECT_NAME/AppDelegate.m file.

12345678910
- #import "AirbridgeCO.h"
- ...
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
-     [AirbridgeCO getInstance:@"YOUR_APP_SDK_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];
-     ...
- }
+ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+     [AirbridgeCordova initializeSDKWithName:@"YOUR_APP_NAME" token:@"YOUR_APP_SDK_TOKEN"];
+     ...
+ }

The AirbridgeCO.init function has been released with the AirbridgeCordova.initializeSDK function. Modify the android/app/src/main/java/.../MainApplication.kt file.

12345678910111213141516
- import co.ab180.airbridge.cordova.AirbridgeCO;
- ...
- @Override
- public void onCreate() {
-     super.onCreate();
-     AirbridgeCO.init(this, "YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN");
-     ...
- }
+ import co.ab180.airbridge.cordova.AirbridgeCordova;
+ ...
+ @Override
+ public void onCreate() {
+     super.onCreate();
+     AirbridgeCordova.initializeSDK(this, "YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN");
+     ...
+ }

Deep Linking

The Airbridge.setDeeplinkListener function has been replaced with the Airbridge.setOnDeeplinkReceivedfunction.

123456
- Airbridge.deeplink.setDeeplinkListener(function (deeplink) {
-     // show proper content
- });
+ Airbridge.setOnDeeplinkReceived(function (deeplink) {
+     // show proper content
+ });

The AirbridgeCO.deeplink.handleURLSchemeDeeplink , AirbridgeCO.deeplink.handleUserActivity functions in iOS has been replaced with the AirbridgeCordova.trackDeeplink function.

12345678910111213141516171819202122232425262728293031323334
- #import "AirbridgeCO.h"
- ...
- (BOOL)application:(UIApplication *)application
-             openURL:(NSURL *)url
-             options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options
- {
-   [AirbridgeCO.deeplink handleURLSchemeDeeplink:url];
-   return YES;
- }
- 
- -  (BOOL)application:(UIApplication *)application
- continueUserActivity:(NSUserActivity *)userActivity
-   restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
- {
-   [AirbridgeCO.deeplink handleUserActivity:userActivity];
-   return YES;
- }
+ @import Airbridge
+ ...
+ - (BOOL)application:(UIApplication *)application
+             openURL:(NSURL *)url
+             options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options
+ {
+   [AirbridgeCordova trackDeeplinkWithUrl:url];
+   return YES;
+ }
+ 
+ -  (BOOL)application:(UIApplication *)application
+ continueUserActivity:(NSUserActivity *)userActivity
+   restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
+ {
+   [AirbridgeCordova trackDeeplinkWithUserActivity:userActivity];
+   return YES;
+ }

The AirbridgeCO.processDeeplinkData function has been replaced with the AirbridgeCordova.trackDeeplinkfunction.

1234567891011121314
- import co.ab180.airbridge.cordova.AirbridgeCO;
- ...
- @Override
- protected void onResume() {
-   super.onResume();
-   AirbridgeCO.processDeeplinkData(getIntent());
- }
+ import co.ab180.airbridge.cordova.AirbridgeCordova;
+ ...
+ @Override
+ protected void onResume() {
+   super.onResume();
+   AirbridgeCordova.trackDeeplink(getIntent());
+ }

In-app events and user data

Attention

The Airbridge.event.trackEvent function has been deleted.

The parameters of the Airbridge.trackEvent function has been modified. The action, label, value parameters can be defined within the semanticAttributes.

Refer to the example codes below to use the Airbridge.trackEvent function.

1234567891011121314151617181920212223
- Airbridge.trackEvent('event', {
-     action: '...',
-     label: '...',
-     value: 100,
-     semanticAttributes: {
-         [AirbridgeAttributes.QUERY]: '...',
-     },
-     customAttributes: {
-         'key1': '...',
-         'key2': '...',
-         'key3': '...',
-     },
- })
+ Airbridge.trackEvent('event', {
+     [AirbridgeAttribute.ACTION]: '...',
+     [AirbridgeAttribute.LABEL]: '...',
+     [AirbridgeAttribute.VALUE]: 100,
+     [AirbridgeAttribute.QUERY]: '...',
+ }, {
+     'key1': '...',
+     'key2': '...',
+     'key3': '...',
+ })

Attention

The action , label , value , semanticAttributes values, which are in the second parameter of the Airbridge.event.trackEvent function must be included in the second parameter of the Airbridge.trackEvent function.

The customAttributes value, which is the second parameter of the Airbridge.event.trackEvent function must be included in the third parameter of the Airbridge.trackEvent function.

The Airbridge.state.setUser , Airbridge.state.updateUser function has been replaced with Airbridge.setUser related functions. The setUser and updateUser functions have been deprecated.

12345
- Airbridge.state.setUser({ ID: '...', email: '...' })
- Airbridge.state.updateUser({ phone: '...' })
+ Airbridge.setUserID('...')
+ Airbridge.setUserEmail('...')
+ Airbridge.setUserPhone('...')

Additional settings

The Airbridge.setAttributionListener function has been replaced with the Airbridge.SetOnAttributionReceived function.

123456
- Airbridge.setAttribuitonListener((attribution) => {
-     // using attribution
- })
+ Airbridge.setOnAttributionReceived((attribution) => {
+     // using attribution
+ })

The Airbridge.placement.click , Airbridge.placement.impression functions have been replaced with the Airbridge.click , Airbridge.impression function.

1234
- Airbridge.placement.click(url)
- Airbridge.placement.impression(url)
+ Airbridge.click(url)
+ Airbridge.impression(url)

The Airbridge.createWebInterface function has been replaced with the Airbridge.createWebInterfaceScript , Airbridge.handleWebInterfaceCommand functions.

123456789101112131415161718192021222324252627282930
- var inAppBrowserRef = cordova.InAppBrowser.open(url, target, options);
- inAppBrowserRef.addEventListener('loadstart', loadstartCallback);
- inAppBrowserRef.addEventListener('message', messageCallBack);
- const webInterface = Airbridge.createWebInterface(
-     'YOUR_WEB_TOKEN',
-     (function (arg) {
-         return `window.cordova_iab.postMessage(${arg})`;
-     })
- );
- function loadstartCallback(event) {
-     inAppBrowserRef.executeScript({ code : webInterface.script });
- }
- function messageCallBack(params){
-     webInterface.handle(JSON.stringify(params.data));
- }
+ const script = await Airbridge.createWebInterfaceScript(
+     'YOUR_WEB_TOKEN',
+     (function (arg) {
+         return `window.cordova_iab.postMessage(${arg})`;
+     })
+ );
+ var inAppBrowserRef = cordova.InAppBrowser.open(url, target, options);
+ inAppBrowserRef.addEventListener('loadstart', loadstartCallback);
+ inAppBrowserRef.addEventListener('message', messageCallBack);
+ function loadstartCallback(event) {
+     inAppBrowserRef.executeScript({ code : script });
+ }
+ function messageCallBack(params){
+     Airbridge.handleWebInterfaceCommand(JSON.stringify(params.data));
+ }

Update within v2.x

See the major changes in each version of the Cordova-Ionic SDK.

v2.6.0

For apps registered with Airbridge after September 4, 2023, the "airbridge_referrer" will no longer be added to the deep link URL provided in the deep link callback. This issue was found in versions v2.5.0 to v2.5.2.

v2.5.0

For apps registered with Airbridge after September 4, 2023, the "airbridge_referrer" will no longer be added to the deep link URL provided in the deep link callback.

In the case of an iOS app update, the last calculated SKAdNetwork Conversion Value is finalized. No additional calculations are processed.

  • In versions earlier than v2.5.1, the SKAdNetwork Conversion Value is only calculated for up to 24 hours.

  • This does not affect users who newly installed the app.

deeplink.page has been deprecated. From v2.5.1, we recommend writing code using the deep link domain, abr.ge.

  • deeplink.page will still be supported and functioning for backward compatibility.

v2.4.0

The default value for trackingAuthorizeTimeout has been changed to 30 seconds.

Was this page helpful?

Have any questions or suggestions?