@anagog/jedai v1.21.0
IMPORTANT NOTE: This readme provides the minimal required steps for integration. For more detailed and explained documentation, you can find it on our website
Integration
ReactNative
Requirements
- ReactNative 0.63 and above
Install the SDK
npm install @anagog/jedai
iOS
Requirements
- Xcode version 13.0 or newer.
- iOS version 11.0 or newer.
Note: Xcode/Swift version depends on the SDK version. SDKs are always built with the latest Xcode version at the time of the release. If you need the SDK built to a specific version, please contact Anagog Customer Support, and we will provide it.
Xcode project
- Go to Signing & Capabilities tab and add the following capablities:
- Background Modes: Background fetch and Remote notifications.
- Access WiFi Information.
- Add the following entries to the Info.plist:
Permitted background task scheduler identifiers
, and then add new item with the valuecom.anagog.jedai.sdk.refresh
.ANAGOG_API_KEY
, and put API KEY that you received from Anagog.
AppDelegate.m
// TODO: Change JemaReactNativeSampleApp by your project name
#import "JemaReactNativeSampleApp-Swift.h"
@import JedAIReactNative;
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[JedAIAppWrapper.shared start];
return YES;
}
// For iOS 11 and iOS 12 only
- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler {
[JedAIAppWrapper.shared refresh];
completionHandler(UIBackgroundFetchResultNewData);
}
// ...
@end
anagog_config.json
In cross-platform frameworks, Anagog SDK can be configured with the anagog_config.json
file located in:
Android - In your android project assets folder android/src/main/assets/anagog_config.json
iOS - In your root iOS project folder ios/anagog_config.json
More information you can find here
Android
Requirements
- compileSdkVersion: 31
- targetSdkVersion: 30
- minSdkVersion: 21
project level build.gradle
buildscript {
ext {
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 30
}
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
- SDK Configuration in AndroidManifest.xml
- Set SDK License Key
- Foregraound service notification title string resourse
- Foreground service notification message setring resourse
- Foreground service notification icon resourse
AndroidManifest.xml
<application
android:name=...
android:theme="@style/AppTheme">
<meta-data android:name="ANAGOG_API_KEY"
android:value="api key as received from Anagog"/>
<meta-data android:name="ANAGOG_NOTIFICATION_ICON"
android:resource="@mipmap/ic_launcher_round"/>
</application>
- Define foreground service string resources
strings.xml
<resources>
...
<string name="anagog_foreground_title">notification title</string>
<string name="anagog_foreground_message">notification body</string>
</resources>
- SDK Config json file
- Create anagog_config.json file in project android/app/src/main directory
- Add the following content with SDK configuration
anagog_config.json
{
"userDefinedStats": {
"Age" : "INTEGER",
"Gender" : "STRING",
"Score" : "DECIMAL",
"AppLaunchCount": "INTEGER",
"OnBoardingCompleted": "STRING"
},
"notificationChannelId": "AwesomeApp",
"foregroundChannelId": "AwesomeApp_FG",
"enableAudienceAnalytics" : true,
"foregroundAlwaysOn" : false,
"enableLatestMs": true,
"enableCrashReports": true,
"enableInternalLog" : true,
"jedaiAutoEnabled" : true
}
Usage
Import
import { AnagogReactNative, ApplicationEvent, JEMAUserInteractionEvent, JEMAUserInteractionEventTriggerType, AnagogEventType, JedAIStatus } from '@anagog/jedai';
SDK Notifications
AnagogReactNative.obtainEventStream((action, payload) => {
switch (action) {
case AnagogEventType.onCampaignTriggered: {
break;
}
case AnagogEventType.onNotificationClick: {
var identifier = payload["campaign_identifier"];
console.log('onNotificationClick Campaign Identifier:', identifier);
var event = new JEMAUserInteractionEvent(identifier, JEMAUserInteractionEventTriggerType.conversion);
AnagogReactNative.sendUserInteractionEvent(event);
break;
}
case AnagogEventType.onSnapshotReport: {
break;
}
case AnagogEventType.onJedAIStatusChange: {
if (payload == JedAIStatus.active)
console.log('JedAI is active');
else if (payload == JedAIStatus.passive)
console.log('JedAI is not running');
break;
}
}
});
Campaigns
Note: Please do not use those APIs in production
// Download AnagogReactNative.syncCampaigns()
// Simulate AnagogReactNative.simulateCampaign() // - all AnagogReactNative.simulateCampaign('campaignId') // - specific
// Get all available campaigns let campaigns = await AnagogReactNative.getCampaigns();
## Microsegments
```js
// Fetch values
let name = await AnagogReactNative.getUserDefinedString('name');
let age = await AnagogReactNative.getUserDefinedInteger('age');
let score = await AnagogReactNative.getUserDefinedDecimal('score');
// Set values
AnagogReactNative.setUserDefinedString('name', 'Alesander');
AnagogReactNative.setUserDefinedInteger('age', 67);
AnagogReactNative.setUserDefinedDecimal('score', 97.5);
Micromoments
let micromoment = new ApplicationEvent('Registration');
micromoment.addTextParameter('Status', 'Completed');
AnagogReactNative.fireMicromoment(micromoment);
You can fire micromoment also this way:
let micromoment = new ApplicationEvent('Registration');
micromoment.addTextParameter('Status', 'Completed');
micromoment.fire();
Interaction events
let event = new JEMAUserInteractionEvent("campaignId", JEMAUserInteractionEventTriggerType.conversion); AnagogReactNative.sendUserInteractionEvent(event);
You can send user interaction event also this way:
let event = new JEMAUserInteractionEvent("campaignId", JEMAUserInteractionEventTriggerType.conversion); event.send();
Reports
// Force schedule reports
AnagogReactNative.forceScheduleReports();
//Request microsegments snapshot report
AnagogReactNative.requestMicrosegmentsSnapshotReport();
JedAI
// Start JedAI
// NOTICE: After calling thing method, JedAI will start automatically on each app start in foreground and background modes.
await AnagogReactNative.enableJedAI();
// Stop JedAI
// NOTICE: JedAI will not start even after app restart until you won't call 'startupJedAI' method.
await AnagogReactNative.disableJedAI();
// Get JedAI status
let status = await AnagogReactNative.getJedAIStatus();
// Share feedback
AnagogReactNative.share();
// Get JedAI SDK Version
let jedaiVersion = await AnagogReactNative.getVersion();
License
Anagog SDK is not open source software or public software. It is the proprietary software of Anagog Ltd. and, unless otherwise agreed in writing with Anagog Ltd., no rights are granted to you in respect of the SDK. This SDK is subject to, and may only be used in accordance with the terms of (and obligations imposed by) a separate commercial license agreement with Anagog Ltd.
You may not copy or use this SDK in any manner without first entering into an agreement with and obtaining a license from Anagog Ltd.
In order to request a license to use this SDK and an activation key from Anagog Ltd., please contact Anagog Ltd. directly at info@anagog.com.
Anagog Ltd. reserves the right, in its sole discretion, to grant or reject requests for licenses to this SDK.
4 months ago
7 months ago
7 months ago
6 months ago
9 months ago
9 months ago
10 months ago
11 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago