Mixpanel connector tools

  • Updated

The Mixpanel connector tools in Optimizely Opal let you query detailed user profiles, export raw event data for behavioral auditing, and build cohorts to target specific user segments. Using JavaScript Query Language (JQL), perform advanced analytics such as funnel and retention reporting.

Complete the following steps to add the Mixpanel connector tools to your Opal instance:

Add the Opal Mixpanel Tool in OCP

Install the Opal Mixpanel Tool in OCP

In the Optimizely Connect Platform (OCP) App Directory, complete the following:

  1. Click Opal Mixpanel Tool.

    Screenshot of the OCP App Directory where the Opal Mixpanel Tool tile is highlighted
  2. Click Install App.

    Screenshot of the Opal Mixpanel Tool page in OCP where the Install App button is highlighted

Create a Mixpanel service account

If you already have a Mixpanel service account, skip this section and go to Complete Mixpanel authentication in OCP. You need your service account username and secret to complete step 5.

A Mixpanel service account is a special type of user intended to represent a non-human entity such as a script or back-end service. To create a service account, complete the following steps:

  1. Go to your Mixpanel organization or project settings.
  2. Click Service Accounts.
  3. Click Add Service Account.
  4. Copy the Username and Secret. You use these credentials in the next section.

For information, go to Service accounts in the Mixpanel documentation.

Complete Mixpanel authentication in OCP

In the Opal Mixpanel Tool in the OCP App Directory, complete the following:

  1. Go to the Settings tab.
  2. Expand the Authentication section.
  3. Enter your Mixpanel Project ID. Find this ID in your Mixpanel project settings.
  4. Select the region where Mixpanel stores your data.
  5. Enter your Service Account Username and Service Account Secret from your Mixpanel service account.
  6. Click Save.

    Screenshot of the Opal Mixpanel Tool Authentication settings in OCP where the Save button is highlighted after credentials are entered

Add the Mixpanel connector tools to Opal

After you add the Opal Mixpanel Tool in OCP, complete the following in OCP:

  1. Click Settings > Add to Opal.
  2. Click Add to Opal for the Opal Account you want to add the Mixpanel connector tools to. Click Remove from Opal to remove the connection.

    Screenshot of the Opal Mixpanel Tool Add to Opal settings in OCP where the Add to Opal button is highlighted

The Mixpanel connector tools are now available in Opal.

Mixpanel connector tools

After you add the Opal Mixpanel Tool in OCP and add the Mixpanel connector tools to Opal, the following tools are available in Opal. Click a tool to expand it and learn when to use the tool, available parameters, and example prompts. If you do not provide a required parameter, Opal prompts you for it.

mixpanel_create_cohort – Creates a cohort (user segment) in Mixpanel. A cohort is a named group of users who share specific attributes or behaviors, such as users who completed a purchase in the last 30 days.
  • When to use
    • Define custom user segments for targeted analysis, experiments, or messaging.
    • Create audiences based on specific user properties, such as geographical location, device type, or subscription level.
    • Build cohorts of users who have performed specific actions (events), such as "Signed Up" or "Purchased," within a certain timeframe.
    • Create reusable user groups for use in other Mixpanel reports or JQL queries.
  • Parameters
    • cohort_name – A name for the cohort. The name must be unique within the Mixpanel project.
    • filters – A JSON string defining the specific filter criteria for the cohort based on user properties or events.
  • Example prompts
    • Create a cohort in Mixpanel called "Premium Users" for anyone whose "plan_type" property equals "premium".
    • I need to create a new user segment named "London Travelers." It should include users where the "$city" property is "London".
    • Help me create a cohort called "Active Shoppers" for users who have performed the "Add to Cart" event in the last 14 days.
    • Create a Mixpanel cohort named "Beta Testers" for users who have the "is_beta_user" property set to true.
mixpanel_execute_jql_query – Execute a JQL query on Mixpanel data.
  • When to use
    • Calculate complex analytical metrics such as specific conversion funnels or user retention.
    • Perform aggregations and group events by multiple custom dimensions.
    • Join data from multiple sources (events and profiles) for behavioral analysis.
    • Extract data summaries that are not available through standard reports.
  • Parameters
    • query – The JQL query script (as a string) to be executed. Must be a valid JavaScript function returning a transformation on events or profiles.
  • Example prompts
    • Run a JQL query to count "Button Click" events grouped by "$os" for the last 30 days.
    • Execute a Mixpanel JQL script to find the conversion rate between "Home Page View" and "Signed Up".
    • Can you call the Mixpanel JQL tool to aggregate our events by user city?
mixpanel_export_events – Export raw event data from Mixpanel for a specified date range.
  • When to use
    • Retrieve raw, individual event records for deep inspection or debugging tracking issues.
    • Export a sample of recent events (for example, the last ten "Page Views") to verify property names and values.
    • Extract data for external processing or to feed into a separate data analysis pipeline.
  • Parameters
    • from_date – The start date for the export in YYYY-MM-DD format. Example, "2025-01-01".
    • to_date – The end date for the export in YYYY-MM-DD format. Example, "2025-01-31".
    • (Optional) event – Filter results to include only a specific event name.
    • (Optional) where – An expression to filter exported events by their property values.
    • (Optional) limit – The maximum number of event records to return.
  • Example prompts
    • Export the raw data for the last 20 "Purchase" events from yesterday.
    • Show me all events from the past week where the "$browser" was "Safari".
    • Export a sample of 10 events from March 1st to March 5th for review.
mixpanel_get_cohort – Get detailed information and metadata about a specific Mixpanel cohort.
  • When to use
    • Inspect the exact filter logic and criteria defined for an existing cohort.
    • Check the total user count or "size" of a segment before targeting them for a campaign.
    • Retrieve metadata like the creation date or owner of a specific cohort ID.
  • Parameters
    • cohort_id – The unique numeric identifier (passed as a string) of the cohort to retrieve.
  • Example prompts
    • What are the filters for Mixpanel cohort ID "15263"?
    • Show me the details and user count for cohort "99887".
    • Get information for the cohort with ID "55512".
mixpanel_list_cohorts – List all user cohorts available in the current Mixpanel project.
  • When to use
    • Browse all existing segments to see what audiences have already been defined.
    • Find the specific cohort ID needed for other tool calls.
    • Audit the names and user counts of all cohorts in the project.
  • Parameters
    • None.
  • Example prompts
    • List all the Mixpanel cohorts for me.
    • What audiences and cohorts are configured in our Mixpanel project?
    • Show me a list of all user segments and their IDs.
mixpanel_query_profiles – Query user profile data from Mixpanel to view attributes and properties.
  • When to use
    • Find specific users who match profile attributes, such as location, account age, or plan level.
    • Retrieve a sample list of users to export for a mailing list or external research.
    • Verify that user properties are being updated correctly in Mixpanel profiles.
  • Parameters
    • (Optional) where – An expression to filter user profiles by their property values.
    • (Optional) limit – The number of profiles to return (for small queries of 1–99 profiles).
    • (Optional) page – The page number for navigating large result sets.
    • (Optional) page_size – The number of profiles per page (minimum 100).
    • (Optional) session_id – A session ID used to maintain consistency across multiple pages of results.
  • Example prompts
    • Show me 25 user profiles for people living in "San Francisco".
    • Find all user profiles where the "plan_type" is "enterprise".
    • Retrieve a list of users whose "total_spend" is greater than 100.

Use cases

The following use cases show how to combine the Mixpanel connector tools to support common marketing, experimentation, content, and operations workflows.

Marketing and audience segmentation

  • Identify high-value segments for campaigns – Use the mixpanel_query_profiles tool to find users who have a specific "Lifetime Value" or "Plan Type" and reside in a certain region. Use the mixpanel_create_cohort tool to create this group as a "VIP Audience" that syncs to your email or ad platforms for targeted messaging.
  • Campaign attribution and funnel analysis – Use mixpanel_execute_jql_query to build a funnel that tracks users from a "Marketing Campaign Click" event to a "Sign up" and finally a "Purchase". This helps you see exactly where potential customers drop off in your marketing journey.
  • Identify "At-Risk" users for re-engagement – Query for users who have not performed a key "Value Event" (for example, "Article Read" or "Dashboard Login") in the last 14 days. Use the mixpanel_export_events tool to export these profiles and trigger a personalized "We miss you" email campaign.

A/B experimentation and component optimization

  • Analyze experiment results – If you are running an A/B test where the variant is tracked as an event property (for example, variant_id = "A"), use the mixpanel_execute_jql_query tool to compare the conversion rates or average order values between groups.
  • Behavioral deep dives for variations – For a specific test variant that performed poorly, use mixpanel_export_events to look at the raw event stream of a sample of users. This can reveal technical errors or friction points unique to that experience.
  • Post-test audience creation – When you conclude an experiment, use the mixpanel_create_cohort tool to group users who interacted with the winning feature. This lets you monitor their long-term retention compared to the rest of your user base.

Content pipeline and engagement

  • Content performance strategy – Use JQL queries to aggregate which content categories (for example, "Tutorials" and "Case Studies") generate the most downstream conversions. This data informs your Content Marketing Platform (CMP) strategy on what topics to prioritize.
  • Personalized content recommendations – Use the mixpanel_query_profiles tool to identify a "Most Viewed Category." Opal can then use this information to suggest similar content pieces or draft personalized newsletters using the content tools.
  • Track the content-to-conversion path – Analyze how many "Blog Post Views" a user typically has before they perform a "Trial Start." This helps marketing teams understand the true ROI of their top-of-funnel content.

General operations

  • Snapshot reports – Use the mixpanel_execute_jql_query tool to get a count of daily active users or specific event totals to include in your weekly status reports.
  • User journey mapping – Export raw event data for "Power Users" to visualize the most common paths they take through your application and optimize the UI for newer users.

If you use Opti ID, administrators can turn off generative AI in the Opti ID Admin Center. See Turn generative AI off across Optimizely applications.