import co.ab180.airbridge.Airbridgeimport co.ab180.airbridge.AirbridgeOptionBuilderimport co.ab180.airbridge.listener.OnAttributionResultReceiveListenerimport tech.notifly.Notiflyclass MainApplication : Application() { override fun onCreate() { super.onCreate() Notifly.initialize(applicationContext, "PROJECT_ID", "USERNAME", "PASSWORD") val option = AirbridgeOptionBuilder("YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN") .setOnAttributionReceived(object : OnAttributionResultReceiveListener { override fun onAttributionResultReceived(result: Map<String, String>) { val properties = mutableMapOf<String, Any>() result["attributedChannel"]?.let { properties["attributedChannel"] = it } result["attributedCampaign"]?.let { properties["attributedCampaign"] = it } result["attributedAdGroup"]?.let { properties["attributedAdGroup"] = it } if (properties.isNotEmpty()) { Notifly.setUserProperties(applicationContext, properties) } } }) .build() Airbridge.initializeSDK(this, option) }}
복사
import notifly_sdkimport Airbridgefunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { Notifly.initialize(projectId: "PROJECT_ID", username: "USERNAME", password: "PASSWORD") let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN") .setOnAttributionReceived { attribution in var props: [String: Any] = [:] if let v = attribution["attributedChannel"] { props["attributedChannel"] = v } if let v = attribution["attributedCampaign"] { props["attributedCampaign"] = v } if let v = attribution["attributedAdGroup"] { props["attributedAdGroup"] = v } if !props.isEmpty { Notifly.setUserProperties(userProperties: props) } } .build() Airbridge.initializeSDK(option: option) return true}
index.js (or App.js)
복사
import notifly from 'notifly-sdk';import { Airbridge } from 'airbridge-react-native-sdk';notifly.initialize({ projectId: 'PROJECT_ID', username: 'USERNAME', password: 'PASSWORD',});Airbridge.setOnAttributionReceived((attribution) => { const props = {}; if (attribution?.attributedChannel) props.attributedChannel = attribution.attributedChannel; if (attribution?.attributedCampaign) props.attributedCampaign = attribution.attributedCampaign; if (attribution?.attributedAdGroup) props.attributedAdGroup = attribution.attributedAdGroup; if (Object.keys(props).length) { notifly.setUserProperties(props); }});
복사
import 'package:notifly_flutter/notifly_flutter.dart';import 'package:airbridge_flutter_sdk/airbridge_flutter_sdk.dart';Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); await NotiflyPlugin.initialize( projectId: 'PROJECT_ID', username: 'USERNAME', password: 'PASSWORD', ); Airbridge.setOnAttributionReceived((Map<String, String> attribution) async { final props = <String, Object>{}; final c = attribution['attributedChannel']; final p = attribution['attributedCampaign']; final g = attribution['attributedAdGroup']; if (c != null) props['attributedChannel'] = c; if (p != null) props['attributedCampaign'] = p; if (g != null) props['attributedAdGroup'] = g; if (props.isNotEmpty) { await NotiflyPlugin.setUserProperties(props); } });}