Event Tracking

Events can represent any generic activity in your application that you think might be worth tracking. Examples could be tapping a button, finishing a game level - really any user interaction that you may want to track and analyze. Special event types such as screen views, eCommerce transactions, and errors are covered later in this guide.

Events are logged using the logEvent method and/or one of its variants.

The JavaScript SDK’s logEvent method takes three arguments:

      mParticle.logEvent('Play Movie Tapped',
                         {'movie_length':'127 minutes','rating':'PG'});

Event Type

The SDK provides an enumeration that represents the possible event types. See below for a description of this categorization.

EventType = {
    Navigation: 1,
    Location: 2,
    Search: 3,
    Transaction: 4,
    UserContent: 5,
    UserPreference: 6,
    Social: 7,
    Other: 8
Event Type Description
Navigation Events that indicate a user click sequence or content consumption. Examples might include interface navigation, music listening, video view, menu or tab selection, or when the back button is pressed.
Location Events that indicate where a user is located or interacting physically. Examples might include a check-in, geo fence, or GPS navigation.
Search Any event where users input criteria to find content/answers. Examples might include a keyword search, voice search, or a QR code scan.
Transaction Any events that are part of a transaction workflow. Examples might include selecting a product, subscribe, upgrade, or bid.
User content Events where users are creating content. Examples might include create task, compose, record, scan, or save.
User preference Any event that creates personalization for the user. This includes registration, saving/labeling content items, creating profiles, setting application preferences or permissions.
Social Any action where users share content with others. Examples might include post, rate, tweet, share, attach, email.
Other Use this event type to create an event that falls into no clear category.

Event Attributes

The Attributes object is a set of key-value pairs containing custom attributes for the event. Each value must be a string, number, boolean or null. Objects and arrays are not permitted. Invalid values will not be forwarded to mParticle.

Custom Flags

Custom flags are used to trigger specific behavior and send specific data-points to particular providers. By design, custom flags are sent only to the specific provider for which they are required. This differs from generic, custom event attributes, which mParticle will send to all of your configured services which support generic key/value event data. Custom Flags cannot be used within an audience definition.

Reference the guide for each integration to see if you need to instrument custom flags.

      mParticle.logEvent('Play Movie Tapped',
                         {'movie_length':'127 minutes','rating':'PG'},
                         {'Lotame.Interest': 'top-40-music'});

Upload Frequency

The JavaScript SDK uploads each event to mParticle immediately as it occurs.