kapa.ai is this trackable "searchResult":{ "counts":[ { 0:{ "count":22 "query":"fusion" "section":"Products" }, { 1:{ "count":40 "query":"fusion" "section":"Accessories" }, } ] }
Based on the knowledge sources provided, I can see that you're asking about tracking a JSON structure with search results data in Mixpanel.Yes, this data structure is trackable in Mixpanel. Mixpanel allows you to track events with custom properties, and you can include this search result data as properties of an event. However, there are a few things to note about the structure: 1. The JSON structure you provided has some syntax issues (extra commas and curly braces), but the general concept of tracking search results is supported.2. When tracking in Mixpanel, you would typically send an event like "Search Performed" and include the search results as properties of that event.For example, using the JavaScript SDK, you could track this data like: LBKSmixpanel.track('Search Performed', { searchQuery: 'fusion', searchResults: { 'Products': 22, 'Accessories': 40 } });LBKSMixpanel can handle nested JSON objects as properties, though very deeply nested structures might be more difficult to analyze in some reports. For complex data structures, you might want to flatten them somewhat for easier analysis.If you're using server-side tracking, most Mixpanel SDKs support sending complex JSON objects as properties as well, as shown in the Go SDK documentation and other SDK documentation provided in the knowledge sources.
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.
Let me check the knowledge base for you again. One moment! ๐
Based on your previous question about tracking search results data, I understand you want to calculate the sum of the "count" values in your search results structure. In Mixpanel, you can create a custom property to calculate this sum in a few different ways:
Using Custom Properties
You can create a custom property in Mixpanel to calculate the sum of counts: 1. Click the plus button to the right of the search bar in a report
2. Select "Event Property" to open the property builder
3. Give your property a name (e.g., "Total Search Results")
4. Use the sum() function to calculate the totalFor your specific data structure, you would need to first ensure your data is properly formatted as a list property, and then you can use the sum function to calculate the total count across all sections.Custom Properties Documentation
For List of Objects
If your search results are stored as a list of objects property (which seems to be the case from your example), Mixpanel provides specific functionality for this: 1. Select your list of objects property (e.g., "searchResult.counts") 2. Choose the "Sum" computation 3. Select the numeric property contained within the objects (e.g., "count")This will give you the total sum for the whole list for that property.List of Objects Property Support
Using JQL (JavaScript Query Language)
For more advanced calculations, you can use JQL with the mixpanel.reducer.sum() function: LBKSfunction main() { return Events({ from_date: "2023-01-01", to_date: "2023-01-31", event_selectors: [{event: "Search Performed"}] }) .reduce(mixpanel.reducer.sum( function(event) { // Calculate sum of counts from the search results var counts = event.properties.searchResult.counts; var total = 0; for (var i = 0; i < counts.length; i++) { total += counts[i].count; } return total; })); }LBKS<https://docs.mixpanel.com/docs/reports/apps/jql|JQL Builtins Documentation>Make sure your data is properly structured when sending it to Mixpanel to ensure these calculations work correctly.Is there a specific report where you're trying to use this sum calculation?
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.
Let me check the knowledge base for you again. One moment! ๐
Based on your question about where to use JQL in Mixpanel, here's how you can access and use the JQL query I provided earlier: You can use JQL in Mixpanel through the JQL App interface: 1. Log in to your Mixpanel account 2. Navigate to the "Apps" section in the left sidebar 3. Select "JQL" from the list of apps 4. In the JQL editor that appears, you can paste the code I provided earlierNote that according to the documentation, JQL is currently in maintenance mode: > โ JQL is in maintenance mode.
Mixpanel is not investing in JQL any further. If you would like to run arbitrary queries on your Mixpanel events, please use our Data Pipelines add-on to export your events to your data warehouse.JQL DocumentationYou can also access JQL through the HTTP API if you prefer to run queries programmatically: ```
sh
curl https://mixpanel.com/api/query/jqlย
-u YOUR_API_SECRET:
--data-urlencode script@โmy_query.js```Where my_query.js would contain your JQL script. This allows you to run JQL queries from your own applications or scripts.Custom JQL Query DocumentationThe JQL API has some limitations to be aware of:
- 60 queries per hour rate limit
- Maximum of 5 concurrent queries
- 2-minute timeout for queries
- 5 GB limit on data processed in a single query
- 2 GB limit on output 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.
Let me check the knowledge base for you again. One moment! ๐
I understand you prefer to use custom properties instead of JQL for calculating the sum of counts. Let me guide you through creating a custom property in Mixpanel to calculate this sum.
Creating a Custom Property for Sum of Counts
1. Open the property builder:
- Click the plus button to the right of the search bar in any report
- Select "Event Property" to open the property builder
Creating a Custom Property2. Name your property:
- Give it a descriptive name like "Total Search Results Count"3. Write the formula:
- For your data structure with search results counts, you'll use the sum() function
- The syntax for sum is: sum(list)
- In your case, you need to access the count values in your searchResult.counts array4. Formula example:
If your data is structured as you showed earlier, you might use something like:
```LBKS
This uses the sum function which "Sums all numbers in the given list. Non-numeric items in the list are ignored."
[Functions Documentation](https://docs.mixpanel.com/docs/features/custom-properties#functions)LBKS5. **Test and apply**:
- Click "Apply" to test the custom property in your current report
- If it works as expected, you can click "Save" to make it permanent and available in other reportsLBKS6. **Share if needed*:
- By default, saved custom properties are private
- You can choose to "Save and Share" to make it available to colleagues or your entire organizationLBKSFor list of objects properties specifically, Mixpanel also offers built-in computation options:
- When you select a list of objects property in a report, you'll see a "Sum" option
- This will prompt you to select the numeric property within the objects (in your case, "count")
- This built-in computation might be easier than creating a custom property in some cases
[List of Objects Property Support](https://docs.mixpanel.com/docs/data-structure/property-reference/data-type#list-of-objects-property-support)LBKSWould you like more specific guidance on any of these steps?
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.
Let me check the knowledge base for you again. One moment! ๐
I understand that the formula sum(searchResult.counts[*].count) isn't working for your custom property. Let me suggest some alternative approaches based on how your data structure might be represented in Mixpanel.
Alternative Formulas to Try
1. If your data structure is exactly as you shared earlier, try:
```LBKS
Note the difference in syntax - using dot notation instead of brackets.LBKS2. You might need to access the nested objects differently:
```LBKS sum(map(X, searchResult.counts, X.count))
```LBKS
This uses the map function to extract the count values before summing them.LBKS3. If the counts are stored with numeric keys as shown in your example:
```LBKS sum(searchResult.counts.0.count, searchResult.counts.1.count)
```LBKS
This explicitly references each count by its index.
Using List Property Computation
Instead of creating a custom property, you might find it easier to use Mixpanel's built-in computation for list properties: 1. In your report, select the "searchResult.counts" property 2. When prompted, choose the "Sum" computation 3. Select "count" as the property to sumThis built-in functionality is specifically designed for list of objects properties and might handle your data structure better than a custom formula.List of Objects Property Support
Check Your Data Structure
If none of these solutions work, it might be helpful to: 1. Use the "Live View" in Mixpanel to see exactly how your data is being received 2. Verify the structure of the searchResult.counts property 3. Make sure the count values are being sent as numbers and not stringsThe exact formula syntax will depend on how your data is actually structured when it reaches Mixpanel.Would you like me to suggest more specific formulas based on what you're seeing in your 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.
