API Docs for: 2.8.5
Show:

mParticle Class

Defined in: src/main.js:60

Invoke these methods on the mParticle object. Example: mParticle.endSession()

Methods

endSession

()

Defined in src/main.js:344

Ends the current session

getAppName

() String

Defined in src/main.js:274

Gets the app name

Returns:

String:

App name

getAppVersion

() String

Defined in src/main.js:290

Gets the app version

Returns:

String:

App version

getIntegrationAttributes

(
  • integrationId
)
Object

Defined in src/main.js:790

Get integration attributes for a given integration ID.

Parameters:

  • integrationId Number

    mParticle integration ID

Returns:

Object:

an object map of the integrationId's attributes

getVersion

() String

Defined in src/main.js:257

Returns the mParticle SDK version number

Returns:

String:

mParticle SDK version number

init

(
  • apiKey
  • [options]
)

Defined in src/main.js:91

Initializes the mParticle SDK

Parameters:

  • apiKey String

    your mParticle assigned API key

  • [options] Object optional

    an options object for additional configuration

logError

(
  • error
)

Defined in src/main.js:383

Used to log custom errors

Parameters:

  • error String or Object

    The name of the error (string), or an object formed as follows {name: 'exampleName', message: 'exampleMessage', stack: 'exampleStack'}

logEvent

(
  • eventName
  • [eventType] The eventType as seen [here]
  • [eventInfo]
  • [customFlags]
)

Defined in src/main.js:352

Logs an event to mParticle's servers

Parameters:

logForm

(
  • selector
  • [eventName]
  • [eventType] The eventType as seen [here]
  • [eventInfo]
)

Defined in src/main.js:422

Logs submit events

Parameters:

logPageView

(
  • eventName
  • [attrs]
  • [customFlags]
)

Defined in src/main.js:434

Logs a page view

Parameters:

  • eventName String

    The name of the event. Defaults to 'PageView'.

  • [attrs] Object optional

    Attributes for the event

  • [customFlags] Object optional

    Custom flags for the event

reset

(
  • keepPersistence
)

Defined in src/main.js:196

Completely resets the state of the SDK. mParticle.init(apiKey) will need to be called again.

Parameters:

  • keepPersistence Boolean

    if passed as true, this method will only reset the in-memory SDK state.

setAppName

(
  • name
)

Defined in src/main.js:282

Sets the app name

Parameters:

  • name String

    App Name

setAppVersion

(
  • version
)

Defined in src/main.js:265

Sets the app version

Parameters:

  • version String

    version number

setIntegrationAttribute

(
  • integrationId
  • attrs
)

Defined in src/main.js:740

Set or remove the integration attributes for a given integration ID. Integration attributes are keys and values specific to a given integration. For example, many integrations have their own internal user/device ID. mParticle will store integration attributes for a given device, and will be able to use these values for server-to-server communication to services. This is often useful when used in combination with a server-to-server feed, allowing the feed to be enriched with the necessary integration attributes to be properly forwarded to the given integration.

Parameters:

  • integrationId Number

    mParticle integration ID

  • attrs Object

    a map of attributes that will replace any current attributes. The keys are predefined by mParticle. Please consult with the mParticle docs or your solutions consultant for the correct value. You may also pass a null or empty map here to remove all of the attributes.

setOptOut

(
  • isOptingOut
)

Defined in src/main.js:715

Set opt out of logging

Parameters:

  • isOptingOut Boolean

    boolean to opt out or not. When set to true, opt out of logging.

setPosition

(
  • lattitude
  • longitude
)

Defined in src/main.js:319

Sets the position of the user

Parameters:

  • lattitude Number

    lattitude digit

  • longitude Number

    longitude digit

setSessionAttribute

(
  • key
  • value
)

Defined in src/main.js:676

Sets a session attribute

Parameters:

  • key String

    key for session attribute

  • value String or Number

    value for session attribute

startNewSession

()

Defined in src/main.js:337

Starts a new session

startTrackingLocation

(
  • [callback]
)

Defined in src/main.js:306

Starts tracking the location of the user

Parameters:

  • [callback] Function optional

    A callback function that is called when the location is either allowed or rejected by the user. A position object of schema {coords: {lattitude: number, longitude: number}} is passed to the callback

stopTrackingLocation

()

Defined in src/main.js:298

Stops tracking the location of the user