Mixpanel Community Icon

Troubleshooting Mixpanel Event Queries with projectKey Issues

·
·

n our front end web app we register a projectKey with every user

mixpanel.register({ projectKey: 'abc-123' });

I am trying to query for specific events with this projectkey. I am using this page to test the query but I get an empty values object https://developer.mixpanel.com/reference/query-event-properties This is how the URL is constructed

https://mixpanel.com/api/query/events/properties?project_id=myid123&event=%5B%22My%20Event%22%5D&name=projectKey&values=%5B%22abc-123%22%5D&type=general&unit=day&from_date=2014-10-01&to_date=2014-10-31

The response is this

{
  "data": {
    "series": [
      "2014-10-01",
      "2014-10-02",
      "2014-10-03",
      "2014-10-04",
      "2014-10-05",
      "2014-10-06",
      "2014-10-07",
      "2014-10-08",
      "2014-10-09",
      "2014-10-10",
      "2014-10-11",
      "2014-10-12",
      "2014-10-13",
      "2014-10-14",
      "2014-10-15",
      "2014-10-16",
      "2014-10-17",
      "2014-10-18",
      "2014-10-19",
      "2014-10-20",
      "2014-10-21",
      "2014-10-22",
      "2014-10-23",
      "2014-10-24",
      "2014-10-25",
      "2014-10-26",
      "2014-10-27",
      "2014-10-28",
      "2014-10-29",
      "2014-10-30",
      "2014-10-31"
    ],
    "values": {}
  },
  "legend_size": 0,
  "computed_at": "2024-11-01T16:58:29.678862+00:00"
}

I know we have events with this project key because i can find this data in the mixpanel UI on the Events tab. I am also trying with the segmentation endpoint https://developer.mixpanel.com/reference/segmentation-query with this as the on query param properties["projectKey"] == "abc-123" But i get the same result

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Based on the information you've provided, there are a few potential reasons why you're not seeing the expected results in your API queries. Let's go through some possible issues and solutions: 1. Date Range: The date range you're querying (2014-10-01 to 2014-10-31) is quite old. Make sure you're querying a date range that matches when your events were actually sent. If your events are more recent, adjust the from_date and to_date parameters accordingly. 2. Event Name: Ensure that "My Event" is exactly the name of the event you're trying to query. Event names in Mixpanel are case-sensitive. 3. Property Name: Confirm that "projectKey" is the exact name of the property you're querying. Property names are also case-sensitive. 4. Inactive Events and Properties: Mixpanel hides events and properties that haven't been fired in the last 30 days from dropdown menus, but they should still be queryable via API. However, it's worth checking if your event or property might be inactive. As mentioned in the [Mixpanel documentation](https://docs.mixpanel.com/docs/tracking-best-practices/debugging#check-for-hidden-events-and-properties): "Mixpanel's report dropdown menus hide events that have not been fired within the last 30 days. [...] Event properties and property values that have not been sent to your project in the last 28 days will also be hidden from dropdowns." 5. Hidden Events or Properties: Check if the event or property might be hidden in Lexicon. As per the [Mixpanel documentation](https://docs.mixpanel.com/docs/tracking-best-practices/debugging#check-for-hidden-events-and-properties): "Project Owner and Admin users can hide events, event properties, and user profile properties in your Mixpanel project through Lexicon. Check Lexicon to review if the event or property may be hidden." 6. API Host: Ensure you're using the correct API host for your project's data residency. According to the [Mixpanel documentation](https://docs.mixpanel.com/docs/tracking-best-practices/debugging#ensure-you-are-using-the-api-host-that-matches-your-projects-data-residency): - US Data Residency: api.mixpanel.com (default) - EU Data Residency: api-eu.mixpanel.com - India Data Residency: api-in.mixpanel.com 7. Project Token: Verify that you're using the correct project token. You can find your project token in the Mixpanel project settings, as described in the [Mixpanel documentation](https://docs.mixpanel.com/docs/orgs-and-projects/managing-projects#find-your-project-tokens). For the segmentation query, your approach looks correct. The on parameter properties["projectKey"] == "abc-123" should work if the property and value exist in your data.

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    If you've verified all these points and are still not getting results, I recommend enabling debug mode in your Mixpanel implementation to ensure the events are being sent correctly. You can find instructions for enabling debug mode in various SDKs in the Mixpanel documentation.If the problem persists after checking these points, you may want to contact Mixpanel support for further assistance, as they can look into your specific project setup and data.

    kapa.ai is still learning and improving, please let me know how I did by reacting below.

    ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.