NAV

Introduction

The mPulse Beacon API (version 2) is a programmatic interface that you can use to send beacons from any web or mobile application to mPulse.

The API includes a REST interface that can be used by web and mobile applications written in any language and running on any platform.

In addition, there are mPulse Beacon API libraries for Android, iOS, Java, and JavaScript.

What types of data can I send?

The mPulse Beacon API lets you send Custom Metric and Custom Timer beacons to mPulse.

For each beacon, you can set the Page Group (View Group), A/B test, and Custom Dimensions.

Getting Started

Before using this API, the user will need to have a mPulse app and an associated API Key. For information on how to setup the mPulse app and the API Key, go to mPulse setup.

Once your app has been configured in mPulse, you can use any integration method to send beacons.

Choosing An Integration Method

Custom Metrics

Custom Metrics are user-defined counts that refer to a business goal, or to a Key Performance Indicator (KPI) such as revenue, conversion, orders per minute, widgets sold, etc. The value or meaning of a Custom Metric is defined by the App Administrator.

You can programmatically increment a Custom Metric using any of the integration methods.

Custom Metrics must be defined in the App dialog before use.

Custom Timers

A Custom Timer can be based on any measurable user-defined duration.

You can programmatically send the value of a Custom Timer using any of the integration methods.

Custom Timers must be defined in the App dialog before use.

Page Groups and View Groups

A Page Group (or View Group in a native app) allows for measurement across pages (or views) that belong together. Grouping pages and views in this way helps you capture and summarize the performance characteristics across the entire group.

For web apps, the home page may make up one Page Group, while the login page may make up a second, and product pages a third such group. Search results and checkout pages may also have their own groups.

You can programmatically set Page Group using any of the integration methods.

Custom Dimensions

In addition to the out-of-the-box dimensions already provided within mPulse, App Admins can define additional Custom Dimensions for the given app. For example, a Custom Dimension to track Premium Users versus Free Users.

You can programmatically set a Custom Dimension using any of the integration methods.

Custom Dimensions must be defined in the App dialog before use.

REST API

The REST API exposes a simple way to send beacon data from any web, native, hybrid, or server app in any programming language.

If you use Custom Timers, Custom Metrics, or Custom Dimensions, then you must define them first. For more information, see Custom Timers, Custom Metrics, and Custom Dimensions.

The use the REST API, developers will need to create HTTP requests for two different URLs:

Getting Config

The Configuration URL is located at:

https://c.go-mpulse.net/api/config.json

You will need the API Key for your mPulse app, as well as the additional required fields covered below.

Request Parameters

The following parameters should be sent in the query string:

Name Value Description
key API-Key Example: XXXXX-YYYYY-ZZZZZ-XXXXX-YYYYY
bcn URL (Optional) Only used on a Config Refresh. Should be the value of beacon_url from the first Config response.
r (empty) (Optional) Only used on a Config Refresh. Used to get a new Anti-CSRF token.

Example:

https://c.go-mpulse.net/api/config.json?key=XXXXX-YYYYY-ZZZZZ-XXXXX-YYYYY&bcn=%2F%2F36d71138.mpstat.us%2F&r=

Response

A JSON object, containing the following values:

Name Description
session_id Session ID for the user. You can use this ID, or you can provide your own session ID (for example, by generating a UUID to use).
h.key The API key you provided.
h.d The app’s domain.
h.t Anti-CSRF timestamp to use when sending beacons. Expires after 10 minutes.
h.cr Anti-CSRF token to use when sending beacons.
beacon_url Where to send beacons to.

Example

{
    "session_id": "6ad5f44a-466f-4373-b3c7-b5cfdd22118d",
    "h.key": "XXXXX-YYYYY-ZZZZZ-XXXXX-YYYYY",
    "h.d": "mobile-beacons.example.com",
    "h.t": 1421874698124,
    "h.cr": "131b1721c986a42bb8f7f8488ad556f12115fa3d",
    "beacon_url": "//xyz.mpstat.us/"
}

Refreshing Config

Changes to the app’s configuration within mPulse will be reflected in the config.json response.

In addition, mPulse may change other data returned by config.json periodically, such as the Beacon URL.

Finally, the request crumb values (h.cr and h.t) expire after 10 minutes. For these reasons, you should refresh config.json every 5 minutes using the &r= parameter.

Sending a Beacon

To send a beacon, you will need to first fetch the config.json response. From that response, you can use the beacon_url to send a beacon.

For example, based on the beacon_url of //36d71138.mpstat.us/ you would send a Beacon to https://36d71138.mpstat.us:

Generic Request Parameters

Parameter Value Sample Required?
api 1 1 Yes
api.v 1 1 Yes
h.key API-key XXXXX-YYYYY-ZZZZZ-XXXXX-YYYYY Yes
h.d h.d from config.json mydomain.com Yes
h.cr h.cr from config.json ad73390de5ba3bdff928806651a4f528dfa98983 Yes
h.t h.t from config.json 1450215931908 Yes
rt.end When the event occurred 1450215932000 Yes
rt.start manual manual Yes
rt.si session_id from config.json (Or your own) c66b9434-965f-47a0-8c41-302dacc1fbcf No
rt.ss Timestamp when the session started 1450215932314 No
rt.sl Session length 3 No
h.pg Page Group My Page Group No
h.ab A/B test AB Test 1 No
cdim[n] Custom Dimension #n MyDimension No

Adding Custom Metrics

To add a Custom Metric, you will need to parse the config.json response for the customMetrics object.

For example, if you have a single Custom Metric:

{ "customMetrics": [{
    "name": "MyMetric",
    "index": 2,
    "type": "Custom",
    "label": "cmet.MyMetric",
    "dataType": "Number"
}]}

Custom Metrics get added to a beacon as the parameter specified by label.

For example, to send a Custom Metric for MyMetric with a value of 1:

cmet.MyMetric=1

Adding Custom Timers

To add a Custom Timer, you will need to parse the config.json response for the customTimers object.

For example, if you have a single Custom Timer: json { "customTimers": [{ "name": "MyTimer", "index":0, "type":"Custom", "label":"custom0" }]}

Custom Timers get added to a beacon as the t_other parameter. t_other is a comma-separated list of Custom Timer labels and values in the following format:

t_other=[label1]|[value1],[label2]|[value2],...

For example, to send a Custom Timer for MyTimer with a value of 10:

t_other=custom0|10

Example

Here’s a full example setting a Page Group, A/B test, and sending a Custom Metric and Timer:

https://<beacon_url>/?
    h.key=XXXXX-YYYYY-ZZZZZ-XXXXX-YYYYY
    &h.d=mydomain.com
    &h.cr=ad73390de5ba3bdff928806651a4f528dfa98983
    &h.t=1450215931908
    &rt.start=manual
    &rt.si=c66b9434-965f-47a0-8c41-302dacc1fbcf
    &rt.ss=1450215932314
    &rt.sl=3
    &h.pg=My%20Page%20Group
    &h.ab=AB1
    &cmet.MyMetric=1
    &t_other=custom0|10

Return Values

The Beacon URL will respond with an empty 204 No Content response.

Android

The mPulse Native Android API can be used in your Android app to send Custom Metrics and Custom Timers to mPulse.

The mPulse Native Android library will also automatically track network requests.

Note that you must define Custom Timers, Custom Metrics, or Custom Dimensions first.

You can use the library with either Ant or Gradle projects.

Getting the Library (AddMPulse)

The AddMPulse utility supports static instrumentation of an Android project that uses ANT.

  1. To get AddMPulse, login to mPulse and open Central > Resources (found at the bottom of the Central tree).
  2. In Resources, locate the Downloads section, and click the Add MPulse Utility to download it.
  3. Unzip the AddMPulse.zip file. This archive contains the AddMPulse executable that is used to perform mPulse Library injection.
  4. From the AddMpulse/ folder, run the AddMPulse command substituting your own values:
AddMPulse/bin/AddMPulse -project <Android project directory>

Where <Android project directory> is the path to the Android folder representing your project.

Note that for Windows the syntax is slightly different. For example:

C:\>AddMPulse\bin\AddMPulse.bat -project <Android project directory>

Getting the Library (Gradle)

Instrumenting an Android app with Gradle can be done by including the two dependencies to your project’s build.gradle files: one at the project level and one at the application level.

In the project’s build.gradle file, add the following line:

buildscript {
    repositories {
        // ...
    }
    dependencies {
        classpath 'com.soasta.mpulse:mpulse-android-gradle-plugin:<replace with most recent version>'
        // ...
    }
}

At the Android application level, two changes are necessary to make mPulse available in your Android application.

At the top of your application’s build.gradle file, apply the mPulse Gradle plugin:

apply plugin: "com.android.application"
apply plugin: "com.soasta.mpulse.android"

Then add the mPulse library to your compilation dependencies:

dependencies {
    compile 'com.soasta.mpulse:mpulse-android:<replace with most recent version>'
    // ...
}

For <replace with most recent version>, you can find the most recent version on JCenter or Maven.

Configuration

Initialization

To use the mPulse Native Android API, you must first initialize your Android project with your API Key:

import com.soasta.mpulse.android.MPulse;

public static final String MPULSE_API_KEY = "YOUR_API_KEY";

// First, initialize with your API Key in the onCreate Method of your Activity
MPulse.sharedInstance().initializeWithAPIKey(MPULSE_API_KEY, getApplicationContext());

// Later, you can interact with MPulse by getting the shared instance
MPulse mpulse = MPulse.sharedInstance();

After you’ve called initializeWithAPIKey(), you can access the shared instance by calling MPulse.sharedInstance().

In most cases, it makes sense to do this in your main Activity’s onCreate() method.

Note: Do not call initializeWithAPIKey() in Application.onCreate(), as the mPulse Native Android library requires an active Activity to initialize.

ProGuard

If you are using ProGuard with minifyEnabled, you will need to add the following to your proguard-rules.pro file:

-keep class com.soasta.** { *; }
-keepattributes Signature

Permissions

In order to send beacons the following Android permissions are required:

Capturing location data is optional and can be activated by adding one of the following permissions:

Or

Example AndroidManifest.xml lines:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

Automatic Network Request Instrumentation

Once included in the project, mPulse will automatically instrument all network requests.

Network requests will be instrumented as long as they are sent from one of the following classes (or a library that uses one of these classes):

Excluding libraries from instrumentation

Should you wish to not instrument a library that is part of your project you can exclude it by using the following configuration closure in your application’s build.gradle file:

mpulseAndroid {
  exclude ~/.*do-not-instrument.*/
}

Notice that the exclude function inside the mpulseAndroid closure accepts Groovy Patterns using the Pattern operator. With this mechanism you can exclude as many JARs as you wish:

mpulseAndroid {
  exclude ~/.*something\.aar$/
  exclude ~/.*something\.jar$/
}

If you wish to exclude the contents of a longer directory path that contains libraries you are using in your project be caucious of using platform specific path seperators:

mpulseAndroid {
  exclude ~".*${File.separator}special-libs${File.separator}.*"
}

Send a Custom Timer

The mPulse Android Native API can be used to send a Custom Timer.

You can track the time it took for an action to occur, such as an image upload or an attachment file download, using Custom Timers.

At the start of your action, call startTimer() by giving it a timerName. startTimer() will return a unique Timer ID (String) and will keep track of the start time:

String timerID = MPulse.sharedInstance().startTimer("MyTimer");
// -> "MyTimer-d4d67062-7064-42b5-85ed-4e69d8824ef9"

At the end of your action, call stopTimer() by passing in the Timer ID. mPulse stops the timer and sends a beacon to the server:

MPulse.sharedInstance().stopTimer(timerID);

You may also directly specify a timer name and value using sendTimer():

// value is in milliseconds
MPulse.sharedInstance().sendTimer("MyTimer", 4);

Send a Custom Metric

You may increment a Custom Metric by using sendMetric():

MPulse.sharedInstance().sendMetric("MyMetric", new Integer(23));

Set View Groups

You may get, set, and reset the View Group. Once set, the View Group will be associated with every subsequent beacon.

Set a View Group using setViewGroup():

MPulse.sharedInstance().setViewGroup("MyViewGroup");

Reset the View Group using resetViewGroup():

MPulse.sharedInstance().resetViewGroup();

Get the current View Group using getViewGroup():

String viewGroup = MPulse.sharedInstance().getViewGroup();

Set Custom Dimensions

You may get, set, and reset Custom Dimensions. Once set, the Custom Dimension will be associated with every subsequent beacon.

Set or reset a Custom Dimension using setDimension():

MPulse.sharedInstance().setDimension("MyDimension", "new value");

Reset the Custom Dimension using resetDimension():

MPulse.sharedInstance().resetDimension("MyDimension");

Troubleshooting

Build Failure (Gradle)

If you see build failures similar to these:

Error:Uncaught translation error: com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type java.lang.Object using a local variable of type int. This is symptomatic of .class transformation tools that ignore local variable information.

or

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException

Then your build most likely failed because the mPulse Android Gradle Plugin failed to instrument a JAR in your application. This often happens when one of your JARs is obfuscated.

Finding JAR files that failed to instrument

To find out which of your JARs failed to instrument, run Gradle from the command line with the flags --debug, --info and --full-stacktrace. With these flags set, you will be able to see which of your JARs our plugin attempted to instrument before failing the build:

MPulseAndroidTransform: Weaving file from /some/path/to/a/file.jar
MPulseAndroidTransform: woven class com.example.app.a.b.c
...

Should you see this followed by an exception this may indicate that the file.jar is failing the build. You can exclude it from instrumentation and thus from throwing an error like this in your build.gradle file:

android { /* ... */ }

/* add this to your code to exclude file.jar from being instrumented */
mpulseAndroid {
  exclude ~/.*file.*/;
}

dependencies { /* ... */ }

Notice that the mpulseAndroid closure is invoked at the top-level of your build.gradle file.

Runtime Exceptions after Upgrade 2.x to 2.2.x

Once you have upgraded your version of mPulse native for Android and have run a new successful build you may run into the following exception:

Process: com.example.App, PID: 1234
  java.lang.NoClassDefFoundError: Failed resolution of: Lcom/soasta/mpulse/android/MPLog;
  /* Long stacktrace pointing to code in third party instrumented library such as Volley */

If so, you may have an issue with a cached compiled version of your application where a previously instrumented version of a third party library is still available. In this specific case, com.soasta.mpulse.android.MPLog was moved to com.soasta.mpulse.core.MPLog.

To prevent this error, you will need to run the following:

In your project directory: $> gradle clean ... $> rm -rf build/

This will remove both build artifacts hidden in the .gradle/ and build/ directories of your project.

The same should be done in any subprojects and folders that also contain a build/ or .gradle/ directory, specific to your Android application.

No Beacons Being Sent

If you are not seeing beacons in the mPulse dashboards, please ensure the app has been configured correctly:

Unable to Refresh Config (log message)

The following message in your ADB log indicates that config.json could not be fetched:

W/MPulse.MPulseInternal: [pool-1-thread-1] Unable to refresh Config.
    java.util.concurrent.TimeoutException
    at java.util.concurrent.FutureTask.get
    at android.os.AsyncTask.get
    at com.soasta.mpulse.android.config.MPConfig.initWithURL
    at com.soasta.mpulse.android.config.MPConfig.refresh
    at com.soasta.mpulse.android.MPulseInternal$1.run
...

If you see this message, it means that mPulse was unable to initialize because it could not fetch the mPulse app configuration. No beacons will be sent.

Please ensure your app can connect to c.go-mpulse.net and that it is not blocked by the application or a firewall.

Activity Context Not Available (log message)

The following message in your ADB log indicates the application may not have been configured properly:

W/MPulse.MPDemographics: Activity context not available...

If you see this message, it means that build.gradle was not configured properly. No beacons will be sent.

Please ensure the apply plugin line is in your project’s build.gradle file:

apply plugin: "com.soasta.mpulse.android"

Debugging Output

To add debugging output, add the following line to the import section:

import com.soasta.mpulse.core.MPLog;

Then add the line below to activate debugging:

MPLog.setDebug(true);

Compilation Errors

If the application is not compiling, please check the following:

iOS

The mPulse Native iOS API can be used in your iOS app to send Custom Metrics and Custom Timers to mPulse.

The mPulse Native iOS library will also automatically track network requests.

If you use Custom Timers, Custom Metrics, or Custom Dimensions, then you must define them first. For more information, see Custom Timers, Custom Metrics, and Custom Dimensions.

You can either use the library via a Framework package or via CocoaPods.

Getting the Library (Framework)

To use the mPulse Native iOS API, you can install the mPulse Native iOS Framework:

  1. Navigate to the mPulse Resources page and download the MPulse.framework.zip archive.

  2. Unzip MPulse.framework.

  3. Drag and drop the framework into your Xcode project.

  4. Navigate to the Build Settings section of your target and add the following (if not already present) to the Other Linker Flags setting: -ObjC

  5. Navigate to the Build Phases section of your target and add the following Libraries (if not already present) to the Link Binary With Libraries step:

    • CoreTelephony.framework
    • CoreLocation.framework
    • SystemConfiguration.framework
    • libc++.dylib or libc++.tdb
    • libz.dylib or libz.tdb
  6. If using mPulse from Swift, you must add the following line to the Objective-C bridging header ([project name]-Bridging-Header.h): #import "MPulse/MPulse.h

Getting the Library (CocoaPods)

The mPulse Native iOS library can also be installed via CocoaPods

gem install cocoapods

pod setup
pod 'mPulse'
pod install

Configuration

To use the mPulse Native iOS API, you must first initialize your iOS project with your API Key.

In most cases, it makes sense to initialize in application:didFinishLaunchingWithOptions:.

Objective-C

#import <MPulse/MPulse.h>

#define MPULSE_API_KEY @"YOUR_API_KEY"

// Initialize the library with your
// mPulse api key, MPULSE_API_KEY
[MPulse initializeWithAPIKey:MPULSE_API_KEY];

// Later, you can get your instance with
MPulse *mpulse = [MPulse sharedInstance];

After you’ve called initializeWithAPIKey:, you can access the mPulse API shared instance by calling [MPulse sharedInstance].

Swift

// If mPulse was installed using Cocoapods then add the following line:
import mPulse

// Initialize the library with your mPulse api key
let apiKey = "YOUR_API_KEY"
MPulse.initializeWithAPIKey(apiKey)

After you’ve called initializeWithAPIKey(), you can access the mPulse API shared instance by calling MPulse.sharedInstance().

Automatic Network Request Instrumentation

Once included in the project, mPulse will automatically instrument all network requests.

Network requests will be instrumented as long as they are sent from one of the following classes (or a library that uses one of these classes):

The following libraries (which use the above classes) will be instrumented:

Send a Custom Timer

The mPulse iOS Native API can be used to send a Custom Timer.

You can track the time it took for an action to occur, such as an image upload or an attachment file download, using Custom Timers.

At the start of your action, call startTimer() by giving it a timerName. startTimer() will return a unique Timer ID (NSString) and will keep track of the start time:

Objective-C:

NSString *timerID = [[MPulse sharedInstance] startTimer:@"TimerName"];

Swift:

let timerID = MPulse.sharedInstance().startTimer("TimerName")

At the “end” of your action, call stopTimer: by passing in the timerID. mPulse stops the timer and sends a beacon to the server:

Objective-C:

[[MPulse sharedInstance] stopTimer:timerID];

Swift:

 MPulse.sharedInstance().stopTimer(timerID)

You may also directly specify a timer name and value (in seconds) using sendTimer::

Objective-C:

// value is NSTimeInterval
[[MPulse sharedInstance] sendTimer:@"TimerName" value:4];

Swift:

MPulse.sharedInstance().sendTimer("TimerName", value: 4)

Send a Custom Metric

You may increment a Custom Metric by using sendMetric::

Objective-C:

[[MPulse sharedInstance] sendMetric:@"MyMetric" value:[NSNumber numberWithInt:23]];

Swift:

MPulse.sharedInstance().sendMetric("MyMetric", value: 23)

Set View Groups

You may get, set, and reset the View Group. Once set, the View Group will be associated with every subsequent beacon.

View Group names are limited to 100 characters, and can include any of the following: 0-9, a-z, A-Z, “ ” (space), _ (underbar) and - (dash)

Set a View Group using setViewGroup::

Objective-C:

[[MPulse sharedInstance] setViewGroup:@"MyViewGroup"];

Swift:

MPulse.sharedInstance().setViewGroup("MyViewGroup")

Reset the View Group using resetViewGroup::

Objective-C:

[[MPulse sharedInstance] resetViewGroup];

Swift:

MPulse.sharedInstance().resetViewGroup()

Get the current View Group using getViewGroup::

Objective-C:

NSString* viewGroup = [[MPulse sharedInstance] getViewGroup];

Swift:

let viewGroup = MPulse.sharedInstance().getViewGroup()

Set Custom Dimensions

You may get, set, and reset Custom Dimensions. Once set, the Custom Dimension will be associated with every subsequent beacon.

Set or reset a Custom Dimension using setDimension::

Objective-C:

[[MPulse sharedInstance] setDimension:@"My Dimension" value:@"new value"];

Swift:

MPulse.sharedInstance().setDimension("My Dimension", value: "new value")

Reset the Custom Dimension using resetDimension::

Objective-C:

[[MPulse sharedInstance] resetDimension:@"My Dimension"];

Swift:

MPulse.sharedInstance().resetDimension("My Dimension")

Troubleshooting

No Beacons Being Sent

If you are not seeing beacons in the mPulse dashboards, please ensure the app has been configured correctly:

FAQ

  1. I see the following error in my build logs:
Ignoring file libMPulse[Sim].a, missing required architecture [arch] in file libMPulse.a ([n] slices)

Answer: This is just a warning, and is expected. The mPulse libraries are split into two files (libMPulse.a and libMPulseSim.a) because of GitHub file size limits (100 MB), where the CocoaPod libraries are hosted. libMPulseSim.a is for simulators and libMPulse.a is for devices, and only one will be used at a time.

Java

The mPulse Java API can be used in your Java app to send Custom Metrics and Custom Timers to mPulse.

Note that you must define Custom Timers, Custom Metrics, or Custom Dimension first.

Getting the Library (Gradle)

Instrumenting a Java app with Gradle can be done by including a dependency to the build.gradle file of your project.

Add the following mPulse Java library to your compilation dependencies:

dependencies {
    compile 'com.soasta.mpulse:mpulse-java:<replace with most recent version>'
    // ...
}

For <replace with most recent version>, you can find the most recent version at JCenter or Maven.

Configuration

Initialization

To use the mPulse Java API, you must first initialize your Java project with your API Key:

import com.soasta.mpulse.core.MPulse;

public static final String MPULSE_API_KEY = "YOUR_API_KEY";

// First, initialize with your API Key
MPulse.sharedInstance().initializeWithAPIKey(MPULSE_API_KEY);

// Later, you can interact with MPulse by getting the shared instance
MPulse mpulse = MPulse.sharedInstance();

After you have called initializeWithAPIKey(), you can access the shared instance by calling MPulse.sharedInstance().

In most cases, it makes sense to do this in your main method or in other app initialization code.

Shutdown

To stop using the Java API, you may call shutdown():

MPulse.sharedInstance().shutdown();

shutdown() may block in order to flush queued beacons. If this behavior is not desired, shutdown() accepts a timeout parameter in seconds. Setting the timeout to 0 will shutdown immediately.

MPulse.sharedInstance().shutdown(0);

The mPulse Java API should not be used after calling shutdown().

Send a Custom Timer

The mPulse Java API can be used to send a Custom Timer.

You can track the time it took for an action to occur, such as an file transfer or database request, using Custom Timers.

At the start of your action, call startTimer() by giving it a timerName. startTimer() will return a unique Timer ID (String) and will keep track of the start time:

String timerID = MPulse.sharedInstance().startTimer("MyTimer");
// -> "MyTimer-d4d67062-7064-42b5-85ed-4e69d8824ef9"

At the end of your action, call stopTimer() by passing in the Timer ID. mPulse stops the timer and sends a beacon to the server:

MPulse.sharedInstance().stopTimer(timerID);

You may also directly specify a timer name and value using sendTimer():

// value is in milliseconds
MPulse.sharedInstance().sendTimer("MyTimer", 4);

Send a Custom Metric

You may increment a Custom Metric by using sendMetric():

MPulse.sharedInstance().sendMetric("MyMetric", new Integer(23));

Set View Groups

You may get, set, and reset the View Group. Once set, the View Group will be associated with every subsequent beacon.

View Group names are limited to 100 characters, and can include any of the following: 0-9, a-z, A-Z, “ ” (space), _ (underbar) and - (dash)

Set a View Group using setViewGroup():

MPulse.sharedInstance().setViewGroup("MyViewGroup");

Reset the View Group using resetViewGroup():

MPulse.sharedInstance().resetViewGroup();

Get the current View Group using getViewGroup():

String viewGroup = MPulse.sharedInstance().getViewGroup();

Set Custom Dimensions

You may get, set, and reset Custom Dimensions. Once set, the Custom Dimension will be associated with every subsequent beacon.

Set or reset a Custom Dimension using setDimension():

MPulse.sharedInstance().setDimension("MyDimension", "new value");

Reset the Custom Dimension using resetDimension():

MPulse.sharedInstance().resetDimension("MyDimension");

JavaScript (mpulse.js)

The mPulse JavaScript API (mpulse.js) allows you to send beacons from JavaScript.

If you use Custom Timers, Custom Metrics, or Custom Dimensions, then you must define them first. For more information, see Custom Timers, Custom Metrics, and Custom Dimension.

Documentation is available at docs.soasta.com/mpulse.js.