Important To use the additional parameters of the custom events for targeting purposes, they must formatted as a valid |
If you want to track a custom event use the trackEvent
method. Events types below 1000
are reserved for the library internal usage. You can use custom event types starting from 1001
.
var eventParams = { "string-type-field": "value", "bool-type-field": true, "number-type-field": 7201, "date-type-field": Math.floor(Date.now() / 1000) }; BMA4S.trackEvent(1001, JSON.stringify(eventParams)); |
Note Each event needs to be defined in the Accengage User Interface. Go to Settings > Advanced Settings, and add a new event of type |
Event API has been updated. You can now use this method for example :
var date = new Date('January 1, 2015 12:00:00'); BMA4S.trackCustomEvent(1000, {'Param1':2, 'Param2':'Start', 'Date': date}); |
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:
BMA4S.trackLead('Lead Label','Lead Value') |
If you want to track an Add to Cart event, add to your code:
BMA4S.trackAddToCart('CartId', 'ArticleID', 'Label', 'Category', 'Currency', 12.30, 1) |
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:
BMA4S.trackPurchase('Purchase ID', 'Purchase Currency', 12.30) |
Note: Currency should be a valid 3 letters ISO4217 currency (EUR,USD,..) and the last argument is the total price of this purchase.
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:
//App starting, update device info var opencount++; //integer value in database scheme var pushOptin = 1; //integer value in database scheme BMA4S.updateDeviceInfo('firstname',"Jack"); //string value in database scheme BMA4S.updateDeviceInfo('age',"21"); //integer value in database scheme BMA4S.updateDeviceInfo('openCount', opencount.toString()) BMA4S.updateDeviceInfo('pushOptin', pushOptin.toString()); |
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. But please note that they MUST be sent in String format when calling updateDeviceInfo() method ! |
A new API is available in order to update device information in a more structured manner.
BMA4S.updateDeviceInformation('set', 'artist_name', 'Hercules'); BMA4S.updateDeviceInformation('delete', 'artist_name'); BMA4S.updateDeviceInformation('increment', 'artist_albums', 1); BMA4S.updateDeviceInformation('decrement', 'artist_albums', 1); |
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”
Geolocation is automatically updated and sent to our servers if "android_no_geoloc" is false inside BMA4SCordovaConfig.json
If you want to manually update the current location of the device, you can call:
BMA4S.updateGeolocation(latitude, longitude, altitude, accuracy); //Example : BMA4S.updateGeolocation(40.12, 2.12, 20, 50) |
You can enable geolocation, geofence and beacon services at any time by calling:
BMA4S.setGeoLocEnabled(true); BMA4S.setBeaconServicesEnabled(true); BMA4S.setGeofenceServicesEnabled(true); |
To disable geolocation, geofence and beacon services, simply use the following:
BMA4S.setGeoLocEnabled(false); BMA4S.setBeaconServicesEnabled(false); BMA4S.setGeofenceServicesEnabled(false); |
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:
BMA4S.setView('DashBoard') |
Where your-view is the name of your view.
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.
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:
BMA4S.putState('search', 'myValue') |
Where "search" is the state name and “myValue” is the value you want to put for this state.
Subscription tag is a new API used to mark user interest for a particular topic with a category, an id and optional parameters :
BMA4S.setDeviceTag(category, id, params), where params is a json containing some optional parameters for the Tag.
Example :
BMA4S.setDeviceTag('Football', 'Brésil', {'club_league_1':'corinthians', 'club_league_2':'figueirense'}); |
A device tag can contain up to 5 parameters and all parameter key should be different. Parameter value should be type of String, Number, Boolean or Date. As mentionned with the name of the method, setDeviceTag is an update of the Subscription Tag, it will override then the previous information. |
You can set an expiration date for your Subscription Tag by adding the parameter "exp" to the Device Tag where the value is a timestamp for the expiration date :
BMA4S.setDeviceTag('Football', 'Brésil', {'club_league_1':'corinthians', 'club_league_2':'figueirense', 'exp':'1543512073'}); |
You can unsubscribe a user to a particular topic with the following code :
Example :
BMA4S.deleteDeviceTag('Football', 'Brésil'); |
Important Please note that this feature is only available through Accengage's API For more information please contact our Support Team at http://ticket.accengage.com |