Overview

An event is a specific interaction or behavior that happens in your mobile app. Integrate your mobile app with Acoustic Campaign SDKs to collect data. When integrated some of these events are sent to the Acoustic Campaign servers. Acoustic Campaign converts these events to Universal Behavior events.

Use these Universal Behavior events to collect statistical data about your application usage. It is a great way to tie user behavior into other interaction channels. The programs module in Campaign can push the user data through the interaction chain. This can lead to sending confirmation messages or cart abandonment messages.

The Campaign server generates metrics and reports on the events received and generated. Not all of these events are converted to Universal Behavior events. Only a subset of events in the Campaign server is converted to Universal Behaviors.

The converted Universal Behavior events are sent to the Acoustic Campaign User Interface. Your team marketer can use these UB events to query data related to the event. For more information, about using UB to create queries see Overview of universal behavior events for mobile apps .

To reduce server load, some events do not get turned into UBs by default. Contact the Acoustic Campaign support team if you would like to enable monitoring of events that are not enabled. The following table shows which events are enabled by default.

Event typeStatus
Mobile App - InstalledEnabled by default
Mobile App - UninstalledEnabled by default
Mobile App - Started a SessionDisabled
Mobile App - Ended a SessionDisabled
Mobile App - Performed a Custom EventDisabled
Mobile App - Opened a Push NotificationEnabled by default
Mobile App - Been Sent a Push NotificationEnabled by default
Mobile App - Enabled Push NotificationsEnabled by default
Mobile App - Disabled Push NotificationsEnabled by default
Mobile App - Push ReceivedDisabled
Location - Entered a GeofenceEnabled by default
Location - Exited a GeofenceDisabled
Location - Entered a Beacon AreaEnabled by default
Location - Exited a Beacon AreaDisabled
Location - Dwelled in a GeofenceDisabled
Location - Dwelled in a Beacon AreaDisabled

Use the Acoustic Campaign SDKs, samples, plugins, and APIs to manage events.

Types of events

Events are generated by the SDK, by plugins, and through custom events sent by your app code.

Events generated by the SDK

Some events are triggered automatically by the SDK. These events can be of two types:

Click events

These events track the user actions of clicking in the mobile app. You do not have the ability to manage these click events. The following are examples of the Click events:

  • URL clicked (urlClicked)
  • App opened from notification (appOpened)
  • Dial action clicked (phoneNumberClicked)
  • Notification action clicked.

Session tracking events

Session tracking events track the user session and send the following events:

  • Session start event. This event is sent when the application is brought to the foreground with no current session in progress.
  • Session end event. This event is sent when the application is sent to the background or the current session timed out. A session end event contains an attribute for the session length.
    You can enable or disable these events and configure the session timeout duration.

Events generated by plugins

Acoustic Campaign provides the ability to enable plugins through the SDK, which can generate events. The following are examples of events created by plugins:

  • Location events (enter, exit and dwell inside geofences or near beacons)
  • Inbox plugin events (message displayed, message marked read)
  • In-app plugin events (message displayed)

Custom events

You can also add code to your app which asks the SDK to create custom events. Custom events are always enabled on the server and converted to Universal Behaviors.

📘

Note

Include customData key values in your arguments passed to the SDK. Then Acoustic Campaign recognizes the Universal behavior events created from these custom events. The events are then created as custom Universal behavior events. The user interface recognizes these events as custom Universal behavior events.

Send events to the Acoustic server

Events can be sent immediately or be queued for later processing on the device. Some events require a fast response and are sent immediately upon request. Other events can wait for a little while; those events can be added to a queue on the device. The SDK will then send queued events after about 15 minutes or whenever an immediate event is sent, whichever comes first.

Immediate events

These are high priority events that are sent immediately to the server as soon as they are created.
Examples of Immediate events:

  1. Click events on a simple notification such as:
  • URL clicked
  • App opened from notification
  • Dial action clicked
  1. Location events: enter, exit and dwell events sent from the device as a result of entering, exiting or dwelling in a geofence or near a beacon.

  2. Session tracking: When a user starts interacting with your app.

Pending events

Pending events are lower priority and can wait until later to be sent to the server. These are sent about every 15 minutes or when an immediate event is sent.

An example of a pending event is when a user session ends the session ended event is added as a pending event to the queue. Then the event will be sent to the server later.

Custom events

Use the Acoustic Campaign APIs to your own custom events that mark your user's progress through the app or are triggered from sensors on the device

The following table shows the various function you can call to manage event queues:

PlatformActionFunction
IOS – Refer to the MCEEventService Class Reference in the IOS API doc.1. Add an event to the queue.
2. Send events in the queue to the server.
1. – addEvent : immediate:
2. – sendEvents
Android – Refer to the Interface QueueEventsClient in the Android API doc.1. Add an event to the queue.
2. Send events in the queue to the server.
1. sendEvent
2. Set the flush parameter to true in the sendEvent method. If true, the event is sent immediately along with all pending events in the database.
Cordova – Refer to the Module: MCEPlugin in the Cordova API doc1. Add an event to the queue.
2. Send events in the queue to the server.
1. queueAddEvent(event, flush)
2. Set the flush parameter to true in the queueAddEvent method. If true, the event is sent immediately along with all pending events in the database.
React Native – Refer to the Acoustic Mobile Push Plugin in the React Native API doc1. Send an event to the server immediately.
2. Send events in the queue to the server.
1. addEvent(event, immediate) Set var immediate = true;
2. sendEvents()

Custom events example

Here is an example of sending a custom event that you might implement in your app. Custom events must be of type "custom".
In this example, we create a custom event indicating that a sales page was visited, so we picked a name for the event of "salesPageVisited".

Custom events can have up to four custom attribute values: customData1, customData2, customData3 and otherCustomData. These are usually strings but can also be numbers and other types depending on the platform. You do not need to specify all attribute fields for your event – simply omit the unneeded attributes.

In order to improve battery life on the customer's device and reduce network traffic, the custom event is added the queue to be sent the next time events are delivered to the server, rather than sending it immediately.


BOOL sendImmediate = FALSE; MCEEvent * event = [[MCEEvent alloc] init]; [event fromDictionary:@{ @"name":@“salesPageVisited", @"type":@“custom", @"timestamp":[NSDate date], @"attributes":@{ @"customData1":pageString, @"customData2": productID, @"customData3": numberToOrder, @"otherCustomData": additionalInformation}}]; [[MCEEventService sharedInstance] addEvent: event immediate: sendImmediate];

letsendImmediate =false     letevent = MCEEvent(       name: "salesPageVisited", type: "custom", timestamp: NSDate(),       attributes: [ "customData1":pageString, "customData2":productID, "customData3":numberToOrder, "otherCustomData":additionalInformation])     MCEEventService.shared.add(event, immediate: sendImmediate)

boolean sendImmediate = false; List<Attribute> attributes = new LinkedList<Attribute>(); attributes.add(new StringAttribute("customData1", pageString)); attributes.add(new NumberAttribute("customData2", productID)); attributes.add(new NumberAttribute("customData3", numberToOrder)); attributes.add(new StringAttribute("otherCustomData", additionalInformation)); CustomEvent event = new CustomEvent("salesPageViewed", new Date(), attributes, null); MceSdk.getQueuedEventsClient().sendEvent(getApplicationContext(), event, sendImmediate);

val sendImmediate = false val attributes = mutableListOf<Attribute>() attributes.add(StringAttribute("customData1", pageString)) attributes.add(NumberAttribute("customData2", productID)) attributes.add(NumberAttribute("customData3", numberToOrder)) attributes.add(StringAttribute("otherCustomData", additionalInformation)) val event = CustomEvent("salesPageViewed", Date(), attributes, null) MceSdk.getQueuedEventsClient().sendEvent(getApplicationContext(), event, sendImmediate)

import {RNAcousticMobilePush} from 'NativeModules'; var sendImmediate = false; var event = {"name": "salesPageViewed", "type": "custom", "attributes": { "customData1": pageString, "customData2": productID, "customData3" numberToOrder, "otherCustomData": additionalInformation}}; RNAcousticMobilePush.addEvent(addToCartEvent, immediate);

var sendImmediate = false; var event = { "type": "custom", "name": "salesPageViewed", "timestamp": new Date(), "attributes":{ "customData1": pageString, "customData2": productID, "customData3": numberToOrder, "otherCustomData": additionalInformation } } MCEPlugin.queueAddEvent(event, sendImmediate);

To create a custom event using the Flutter SDK, you must create a sendEvent() function to pass the user input data to the SDK. The SDK then creates a custom event.

  1. Import the following packages.
    import 'package:flutter_acoustic_mobile_push/flutter_acoustic_sdk_push.dart'; import 'package:flutter_acoustic_mobile_push/event/flutter_event_pay_load.dart'; import 'package:flutter_acoustic_mobile_push/user_attribute/flutter_attribute_pay_load.dart';
  2. Create the event.
    List attributePayLoad = []; attributePayLoad.add(StringAttribute("customData1", pageString)); attributePayLoad.add(NumberAttribute("customData2", productID)); attributePayLoad.add(NumberAttribute("customData3", numberToOrder)); attributePayLoad.add(StringAttribute("otherCustomData", additionalInformation)); EventPayLoad eventPayLoad = EventPayLoad(); eventPayLoad.type = "custom"; eventPayLoad.name = "salesPageViewed"; eventPayLoad.timestamp = DateTime.now(); eventPayLoad.attributes = attributePayLoad; eventPayLoad.isImmediate = true; FlutterAcousticSdkPush.sendEvent(eventPayLoad);

For additional information on event payload, attribute functionality, and input field creation, see

Enable or disable session events

By default, session events, which track how long a user engaged with your app, are sent from the device to the Acoustic Campaign server, but are not converted into UBs. If you don't need them, you can configure the SDK not to send them.

The first time the application is sent to the foreground, a new session is created. The usual session length is 20 minutes.

A service checks every 30 seconds to see if the application is in the background. If the application is in the background for longer than the defined length, the session ends.

When the application comes back to the foreground a new session is created. You can set whether sessionEvents are generated and the time after which a new session starts in MceConfig.json.

"Setting sessionEnabled to true will trigger session start and session end events": "", 

 "sessionsEnabled": true, 

 

 "sessionTimeout is the number of minutes the SDK wait while the application is in the background before sending session end event": "", 

 "sessionTimeout": 20,