Mixpanel connector tools

  • Updated

The Mixpanel connector tools in Optimizely Opal provide a powerful integration that lets you query detailed user profiles and export raw event data for in-depth behavioral auditing. By utilizing JavaScript Query Language (JQL), you can perform sophisticated analytics, such as funnel and retention reporting, to uncover hidden patterns in user interactions. Furthermore, the ability to manage and create cohorts lets you translate these insights into targeted segments.

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 OCP App Directory, complete the following:

  1. Click Opal Mixpanel Tool.

  2. Click Install App

Configure your Mixpanel service account (optional)

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. If you do not have a service account already, complete the following steps to create one in Mixpanel:

  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.

See Service accounts in the Mixpanel documentation for information.

Complete Mixpanel authentication in OCP

  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 you created in the Configure your Mixpanel service account (optional) section.
  6. Click Save.

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. 

You can now use the Mixpanel connector tools within Opal. 

Mixpanel connector tools

After you Add the Opal Mixpanel Tool in OCP and Add the Mixpanel connector tools to Opal, you can call the following tools in Opal. Click on a tool to expand it to 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 new cohort (user segment) in Mixpanel.
  • 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 that can be quickly referenced in other Mixpanel reports or JQL queries.
  • Parameters
    • cohort_name – The descriptive name for the new cohort. This should 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 sophisticated behavioral analysis.
    • Extract data summaries that aren't 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-31".
    • to_date – The end date for the export in YYYY-MM-DD format. Example, "2025-01-01".
    • (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 reference in other tool calls.
    • Quickly audit the names and user counts of all cohorts in your 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

Mixpanel connector tools within Opal provide powerful ways to link your product analytics with your marketing, experimentation, and content workflows. 

Marketing and audience targeting

  • 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. You can then 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 Management Program (CMP) strategy on what topics to prioritize in the next quarter.
  • 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.