Accengage SDK allows you to track the execution and display of In-App and to handle Push notifications of your application.
This Phonegap/Cordova documentation explains the various methods available and how to use them.
Current Plugin Version: 1.0.0 (January 2015)
- Android SDK Version: 3.1.1
- iOS SDK Version: 5.1.1
Update the file config/BMA4SCordovaConfig.json with your PartnerID and you privateKey BEFORE preparing/building your app on Cordova.
After you changed the values inside BMA4SCordovaConfig.json and you have built your app once, you can't change your config anymore using this file.
You have to do a full plugin remove and then a plugin add again.
Never the less, you can manually change your configuration by editing some files.
For instance, Android SDK configuration is inside both plugins/android.json ,plugins/com.bma4s.sdk.plugins.cordova/plugin.xml and platforms/android/AndroidManifest.xml files.
This way is not recommended (it's better to save the config folder, then do a full plugin reinstallation and finally restore your saved config folder before calling cordova prepare or cordova build)
In order to be able to compile, you have to use at least the target android-21. Please check your platfoms/android/project.properties file:
If the line target displays a target below android-21, please change it to:
Please DO NOT copy paste the content of this example (comments are not allowed inside a valid JSON file) Fields with * means REQUIRED
Please see platform related (iOS,Android) documentation for more information (methods usage, advanced integration..)
Enable Pushs Notifications
To enable pushs notifications for iOS, edit your config/BMA4SCordovaConfig.json file with the following line:
Please see iOS Documentation for more informations.
Add your own sender Id to the config/BMA4SCordovaConfig.json file:
Please see Android Documentation for more informations.
Prevent RichPush notifications display
You can prevent the display of any RichPush notification, by calling:
To reenable the RichPush Notifications, you can call:
You can enable/disable RichPush notifications at any time.
If you need to know the Rich Push lock status:
This lock does not affect In-App notifications.
If you want to track a specific event you can add to your code:
Where 1000 is your eventID and “test” is an argument of this event. Please note that you can add multiple arguments.
You can track specific events like “Add to Cart”, “Purchase” and “Lead”. Here is how to use each of these events.
If you want to send a Lead, you can add to your code:
Add to Cart
If you want to track an Add to Cart event, add to your code:
Note: Currency should be a valid 3 letters ISO4217 currency (EUR,USD,..) and the 2 last arguments are price and quantity.
If you want to track a Purchase event, you can add to your code:
Note: Currency should be a valid 3 letters ISO4217 currency (EUR,USD,..) and the last argument is the total price of this purchase.
Update Device Information
You can create a device profile for each device in order to qualify the profile (for example, registering whether the user is opt in for or out of some categories of notifications). A device profile is a set of key/value that are uploaded to Accengage server. In order to update information about a device profile, add the following lines to your code:
Replace “key” and “value” with the segmentation key name and the value you want to set.
The keys and values must match Accengage user information field names and values to allow information to be correctly updated.
You can send a date using the updateDeviceInfo method.
Your date has to be in the following format: “yyyy-MM-dd HH:mm:ss zzz”
If you want to tag each Fragment/Tabs/Activity and be able to target it, you can use the following code as soon as a view is displayed:
Where your-view is the name of your view.
States (Android only)
In Accengage Interface, you can “Declare a State” (Applications → Advanced Parameters). States are like browser cookies which can be used to trigger Accengage In-App notifications. You can target one or more states and combine them with Event or ViewTag.
Example: When event 5000 is triggered and state “search” contains “pizz*”, display a specific In-App.
The following section explains how to declare certain states with the Accengage SDK.
Put a State
You can obtain the name of the state from the Accengage “value” field in Applications → Advanced Parameters → States section.
In order to put a state, write this code:
Where "search" is the state name and “myValue” is the value you want to put for this state.
Add your Facebook AppID in config/BMA4SCordovaConfig.json:
This will enable Facebook Tracking inside your app, no other step is needed on your behalf.
Retrieve custom parameters from Push/In-App/Inbox
If you want to retrieve custom parameters from Push, In-App or Inbox features, call:
Each time an Push/In-App/Inbox is displayed or clicked, you will receive a response like this one:
Here, it's a push which has just been clicked.
action can contains:
categories can contains:
All parameters including your custom parameters are inside params (here we have a custom param named 'my-key')
Stop listening for custom parameters
If you don't want to retrieve custom parameters anymore, please call:
Prevent In-App notification display
If you don't want to display any inapp message temporarily, you can use:
This function allows you to enable or disable any In-App notification display. By default, its value is false which means that InApp display is enabled.
Once Inapp is locked, no In-App visual element will be displayed until unlocked. Please use this function with care!
Inbox is not yet available in our Cordova Plugin and must be implemented the native way
For iOS, please see iOS Documentation.
For Android, please see Android Documentation.
Find your A4SID (or Device ID or Mobinaute ID)
If you need to get the Accengage Device ID (or "Mobinaute Id") of the user, use the following method:
Restrict SDK connection
You can temporarily restrict the connections in order to tell our SDK to stop flushing network requests.
All requests will be locked until you use setRestrictedConnection(false). In order to know if the connection is restricted for our SDK, please use:
Specific for Android
To enable logs in the console, you can modify the following value of BMA4SCordovaConfig.json :
You will have to rebuild your app in order to see the logs
Specific for iOS
To enable logs in the console, you can use the method:
Please see the iOS Troubleshooting.