• Home
  • Integrations
  • SDKs
  • Guides
  • API docs
    No results for ""
    EXPAND ALL

    EDIT ON GITHUB

    mParticle

    Read time: 2 minutes
    Last edited: Apr 06, 2023

    Overview

    This topic explains how to create and test an mParticle destination for Data Export.

    mParticle is a customer data platform that allows you to aggregate your analytics and create customer cohorts.

    Prerequisites

    To set up an mParticle destination in LaunchDarkly, you need:

    • Your mParticle server-to-server key
    • Your mParticle server-to-server secret

    The key and secret are available in your mParticle account. Copy and save both strings. You'll need them to connect mParticle to LaunchDarkly.

    Here is an image of the mParticle API keys dialog:

    The mParticle API keys dialog.
    The mParticle API keys dialog.

    Creating the mParticle destination in LaunchDarkly

    You can use the LaunchDarkly UI to create and modify destinations for Data Export.

    To create an mParticle destination in LaunchDarkly:

    1. Navigate to the Integrations page and find "mParticle."
    mParticle on the "Integrations" page.
    mParticle on the "Integrations" page.
    1. Click Add integration. The "Create a destination" panel appears.
    2. (Optional) Enter a Name for the destination.
    3. Select an Environment for this destination to receive events from.
    Environment settings are permanent

    You cannot change an environment after you create the destination. If you wish to export event data from a different environment, you must set up another destination.

    1. Select an mParticle Environment.
    2. Enter your mParticle server-to-server key in the API key field.
    3. Enter your mParticle server-to-server secret in the API secret field:
    The "Create a destination" panel.
    The "Create a destination" panel.
    1. Select a User Identifier type from the menu:
    The "User identifier" menu.
    The "User identifier" menu.
    Choose the correct user identifier for your events

    The user identifier you choose must match an identifier you chose to identify users in the mParticle ecosystem.

    Every event LaunchDarkly exports has a context key specified by the SDK. The user identifier should correspond to the mParticle user identity your SDK context key represents. For example, if your context key represents a customer ID, you should choose customer_id as the user identifier.

    To learn more about exported events, read Schema reference.

    1. (Optional) If you use anonymous contexts, select the Anonymous user identifier type from the menu.

      If you select this user type, you must also configure your mParticle SDK to send an alias event. Alias events connect an anonymous user ID with the user ID of a known user in mParticle. This ensures that your users are identified and counted accurately. To learn more about alias events in mParticle, read mParticle's documentation on associating anonymous and known users.

    2. Check the checkbox indicating you consent to the Integration Terms and Conditions.

    3. Click Save destination.

    The mParticle destination appears in the "Your data export destinations" section of the Integrations screen.

    Testing an mParticle destination

    After you save the destination, send a test event to confirm that the destination is configured properly.

    To send a test event:

    1. Navigate to the Integrations page and find "mParticle."
    2. Click into the "mParticle" section to display a list of destinations.
    3. Click the edit icon next to the destination you want to test. The "Edit destination" panel appears.
    4. In the "Send a test event" section, click Send event:
    The "Send a test event" section of the "Edit destination" panel.
    The "Send a test event" section of the "Edit destination" panel.
    1. Verify the event appears on the mParticle events live stream.

    Example events

    These example events display the structure of the events LaunchDarkly sends to mParticle.

    LaunchDarkly sends events in the following formats:

    {
    "user_identities": {
    "customer_id": "EXAMPLE-CUSTOMER"
    },
    "environment": "EXAMPLE-ENVIRONMENT-NAME",
    "events": [
    {
    "event_type": "CUSTOM-EVENT",
    "data": {
    "source_message_id": "###-##",
    "event_name": "EXAMPLE-FEATURE-NAME",
    "timestamp_unixtime_ms": 1590697814783,
    "custom_event_type": "other",
    "custom_attributes": {
    "project": "EXAMPLE-PROJECT-NAME",
    "environment": "5d4b12345d2a2806bd2cc6eb",
    "version": "1",
    "key": "flag",
    "value": "true",
    "flag_version": "42",
    "default": "false",
    "reason_kind": "FALLTHROUGH",
    "prerequisite_of": "PARENT-FLAG",
    "event_type": "custom_event"
    }
    }
    }
    ]
    }

    Enabling Data Export for flags and environments

    After you create a Data Export destination, you must start sending flag or environment event data to it. You can enable Data Export for individual flags, or for all the flags in an environment.

    To learn more about exporting event data from flags and environments, read Data Export.

    Deleting an mParticle destination

    You can delete a Data Export destination from the Integrations screen.

    To delete a destination:

    1. Navigate to the Integrations page and find "mParticle."
    2. Click into the "mParticle" section to display a list of destinations.
    3. Click the edit icon next to the destination you wish to delete. The "Edit destination" panel appears.
    4. Click Delete destination:
    The "Delete destination" section of the "Edit destination" panel.
    The "Delete destination" section of the "Edit destination" panel.