Send custom data with mPulse

General API documentation for Boomerang can be found at https://akamai.github.io/boomerang/.

mPulse-specific documentation is below:

BOOMR.sendMetric(name, value)

The sendMetric() API sends a Custom Metric to mPulse. The Custom Metric must already be defined in the mPulse dialog.
For currencies, if sent a JavaScript number the value will be interpreted as cents (divided by 100). If sent a JavaScript string with a decimal, it will be interpreted as-is.

Parameters

  • name - String: Custom Metric name (not the JavaScript definition)
  • value - Number: Metric value (such as 1 or 10)

Example

// send an single metric
BOOMR.sendMetric("MyMetric", 2);
BOOMR.sendMetric("Currency1", 100); // $1.00
BOOMR.sendMetric("Currency2", "100.00"); // $100.00

BOOMR.sendMetrics(metrics)

The sendMetrics() API sends multiple Custom Metrics to mPulse. The Custom Metrics must already be defined in the mPulse app dialog.
For currencies, if sent a JavaScript number the value will be interpreted as cents (divided by 100). If sent a JavaScript string with a decimal, it will be interpreted as-is.

Parameters

  • metrics - Object: A map of Custom Metric names to values

Example

// send multiple metrics at once
BOOMR.sendMetrics({
    "MyMetric": 2,
    "MyOtherMetric": 1,
    "Currency1": 100, // $1.00
    "Currency2": "100.00" // $100.00
});

BOOMR.sendTimer(name, value)

The sendTime() API sends a Custom Timer to mPulse. The Custom Timer must already be defined in the mPulse app dialog.

Parameters

  • name - String: Custom Timer name (not the JavaScript definition)
  • value - Number: Timer value (such as 10 or 1000) in milliseconds

Example

// send a single timer
BOOMR.sendTimer("MyTime", 200);

BOOMR.sendTimers(timers)

The sendTimers() API sends multiple Custom Timers to mPulse. The Custom Timers must already be defined in the mPulse app dialog.

Parametercs

  • timers - Object: A map of Custom Timer names to values

Example

// send multiple timers at once
BOOMR.sendTimers({
    "MyTime": 200,
    "MyOtherTime": 1000
});

BOOMR.sendAll(data)

The sendAll() API sends multiple Custom Metrics, Timers, Dimensions, and other data to mPulse. The Custom Metrics, Timers, and Dimensions must already be defined in the mPulse app dialog.

Parametercs

  • data.metrics - Object: A map of Custom Metrics names to values (optional)
  • data.timers - Object: A map of Custom Timer names to values (optional)
  • data.vars - Object: A map of additional beacon values (optional)
  • data.when - number: Timestamp for the beacon (optional)

Example

BOOMR.sendAll({
    metrics: {
        MyMetric: 2,
        MyOtherMetric: 1,
        Currency1: 100, // $1.00
        Currency2: "100.00" // $100.00
    },
    timers: {
        MyTime: 200,
        MyOtherTime: 1000
    },
    vars: {
        "cdim.LoggedIn": true, // Custom Dimension named "LoggedIn"
        var2: 2
    },
    when: Date.now()
});