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 } });LBKS
Mixpanel 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](https://mixpanel.com/api/query/jql) \ -u YOUR_API_SECRET: \ --data-urlencode script@​my_query.jsLBKS
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.
Let me check the knowledge base for you again. One moment! 📚
I see you're getting a specific error message when trying to create a custom property formula in Mixpanel. The error "Missing required parameter: unexpected character: for .count" suggests there's a syntax issue with how you're trying to access the count property.Let's troubleshoot this based on your data structure:
Possible Solutions
1. Check for special characters or spaces: The error suggests there might be an unexpected character in your formula. Make sure there are no extra spaces or special characters in your formula.2. Try alternative syntax:
```LBKS
Using the map function with quotes around the property name might help if "count" contains special characters or is being interpreted incorrectly.LBKS3. **Simplify and test step by step**:
Start with a simpler formula to confirm you can access the data at all:
```LBKS searchResult.counts[0].count
```LBKS
If this works, then try:
```LBKS sum(filter(X, searchResult.counts, true).count)
Check Data Format
The error might also indicate that your data structure isn't exactly as expected. In the Mixpanel custom properties documentation, the sum function is defined as: > "Sums all numbers in the given list. Non-numeric items in the list are ignored."Custom Properties FunctionsMake sure that: 1. The "count" values are actually numbers and not strings 2. The property path to access them is correct
Alternative Approach
If you continue to have issues with the custom property formula, consider: 1. Calculating the sum before sending the data to Mixpanel 2. Adding a new property "total_count" to your events that contains the pre-calculated sum 3. Using this simpler property in your reportsThis approach would avoid the need for complex formulas in Mixpanel itself.Would you be able to share a screenshot of the exact data structure as it appears in Mixpanel's Live View? That would help me provide more specific guidance for your particular data format.
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.
"pagetypedd": "",
"precisionEventData": {
"productRegistrationData": {},
"searchResult": {
"counts": [
{
"count": 0,
"query": "B5116206B",
"section": "Products & Accessories"
},
{
"count": 0,
"query": "B5116206B",
"section": "Inspiration"
}
],
"matchSections": [],
"noMatchSections": [
"Products & Accessories",
"Inspiration"
],
"screen": "Result",
"searchString": "B5116206B"
}
}
Let me check the knowledge base for you again. One moment! 📚
I see you've shared a more detailed JSON structure of your search result data. This helps me understand the exact format of your data in Mixpanel.Based on this structure, here's how you can create a custom property to calculate the sum of counts:
Creating a Custom Property for Sum of Counts
Since your data is structured as: LBKSprecisionEventData.searchResult.counts[ {count: 0, query: "B5116206B", section: "Products & Accessories"}, {count: 0, query: "B5116206B", section: "Inspiration"} ]LBKS
Try this formula in your custom property: LBKSsum(map(X, precisionEventData.searchResult.counts, X.count))LBKS
This formula:
1. Uses map()
to extract just the count values from each object in the array
2. Then applies sum()
to add up all those valuesIf you're still encountering issues, you could try: LBKSsum(precisionEventData.searchResult.counts[*].count)LBKS
Or even more explicitly: LBKSprecisionEventData.searchResult.counts[0].count + precisionEventData.searchResult.counts[1].countLBKS
Using List of Objects Property Support
Alternatively, you can use Mixpanel's built-in functionality for list of objects: 1. In your report, select the property "precisionEventData.searchResult.counts" 2. Choose the "Sum" computation option 3. Select "count" as the property to sumThis approach might be more reliable as it's specifically designed for list of objects properties like yours.List of Objects Property SupportIn your specific example, the sum would be 0 (since both count values are 0), but the formula would work for any values in those fields.
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 see you're getting a specific error with the formula highlighting "searchResult" in pink. This suggests there might be an issue with how Mixpanel is parsing the property path.Let's try some alternative approaches to fix this error:
Try these alternative formulas:
1. Use quotes around property names that contain dots: LBKSprecisionEventData["searchResult"].counts[0].count + precisionEventData["searchResult"].counts[1].countLBKS
2. Or try using quotes for the entire path: LBKS"precisionEventData.searchResult.counts[0].count" + "precisionEventData.searchResult.counts[1].count"LBKS
3. If you're using Mixpanel's Aggregate Property feature, try a different syntax: LBKSsum(precisionEventData["searchResult"]["counts"][*]["count"])LBKS
Check for special characters
The error "unexpected character: ." suggests that Mixpanel might be having trouble with the dot notation in your property path. This could happen if: 1. There are spaces in your property names 2. The property names contain special characters 3. The structure of your data is slightly different than expected
Alternative approach using Measurements
Instead of creating a custom property, you might have better luck using Mixpanel's built-in "Aggregate Property" measurement: 1. In your Insights report, click on the measurement dropdown (usually shows "Unique Users" by default) 2. Select "Aggregate Property" 3. Choose "Sum" as the aggregation type 4. Select your property pathThis approach uses Mixpanel's built-in aggregation functions which might handle your data structure better.Aggregate Property DocumentationIf you continue to have issues, consider simplifying your data structure when sending it to Mixpanel, or pre-calculating the sum before sending the event.Would you like me to suggest any other approaches to solve this issue?
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.