{"_id":"5667b4deacfd301700c4e9ac","__v":0,"tags":[],"initVersion":{"_id":"55773a5ba042551900b002ce","version":"1"},"project":"55773a5ba042551900b002cb","user":{"_id":"546d17e2eb9cfd1400dd4529","username":"","name":"World Triathlon"},"createdAt":"2015-12-09T04:58:06.703Z","changelog":[{"_id":"5667b4deacfd301700c4e9ae","update":"Funnels Endpoint at /statistics/funnels","type":"added"},{"_id":"5667b4deacfd301700c4e9ad","update":"","type":"added"}],"body":"The [Statistics API now contains the ability to perform funnel analysis](https://developers.triathlon.org/docs/funnel). Much like the [example in the Data Explorer Funnels](https://developers.triathlon.org/blog/data-explorer-funnels) this allows a broader range of analysis to be completed with queries that would previously have taken some level of scripting to solve which can now be answered directly.\n\nThe significant advantage to using the API over the data explorer is that the **with_actors** property is available whereby you may list athletes matching the selected funnel steps.\n\nContinuing on with the example of WTS wins over both Standard and Sprint distance a POST request to /statistics/funnel with a body as below and a 'Content-Type' header of application/json will yield the result.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"steps\\\": [\\n      {\\n        \\\"with_actors\\\": \\\"false\\\",\\n        \\\"actor_property\\\": \\\"athlete.name\\\",\\n        \\\"filters\\\": \\\"position,eq,1|athlete.gender,eq,male|format,eq,Standard\\\",\\n        \\\"timeframe\\\": \\\"this_8_years\\\",\\n        \\\"optional\\\": false,\\n        \\\"inverted\\\": false,\\n        \\\"collection\\\": \\\"results\\\"\\n    },\\n    {\\n        \\\"with_actors\\\": \\\"true\\\",\\n        \\\"actor_property\\\": \\\"athlete.name\\\",\\n        \\\"filters\\\": \\\"position,eq,1|athlete.gender,eq,male|format,eq,Sprint\\\",\\n        \\\"timeframe\\\": \\\"this_8_years\\\",\\n        \\\"optional\\\": false,\\n        \\\"inverted\\\": false,\\n        \\\"collection\\\": \\\"results\\\"\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nThe result being that whilst 11 athletes have won a standard distance race only 3 of those have also won a Sprint distance race (namely both Brownlees and Mario Mola).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"code\\\": 200,\\n    \\\"status\\\": \\\"success\\\",\\n    \\\"data\\\": {\\n        \\\"steps\\\": [\\n            {\\n                \\\"with_actors\\\": false,\\n                \\\"actor_property\\\": \\\"athlete.name\\\",\\n                \\\"filters\\\": [\\n                    {\\n                        \\\"operator\\\": \\\"eq\\\",\\n                        \\\"property_name\\\": \\\"position\\\",\\n                        \\\"property_value\\\": 1\\n                    },\\n                    {\\n                        \\\"operator\\\": \\\"eq\\\",\\n                        \\\"property_name\\\": \\\"athlete.gender\\\",\\n                        \\\"property_value\\\": \\\"male\\\"\\n                    },\\n                    {\\n                        \\\"operator\\\": \\\"eq\\\",\\n                        \\\"property_name\\\": \\\"format\\\",\\n                        \\\"property_value\\\": \\\"Standard\\\"\\n                    }\\n                ],\\n                \\\"timeframe\\\": \\\"this_8_years\\\",\\n                \\\"timezone\\\": null,\\n                \\\"event_collection\\\": \\\"results\\\",\\n                \\\"optional\\\": false,\\n                \\\"inverted\\\": false\\n            },\\n            {\\n                \\\"with_actors\\\": true,\\n                \\\"actor_property\\\": \\\"athlete.name\\\",\\n                \\\"filters\\\": [\\n                    {\\n                        \\\"operator\\\": \\\"eq\\\",\\n                        \\\"property_name\\\": \\\"position\\\",\\n                        \\\"property_value\\\": 1\\n                    },\\n                    {\\n                        \\\"operator\\\": \\\"eq\\\",\\n                        \\\"property_name\\\": \\\"athlete.gender\\\",\\n                        \\\"property_value\\\": \\\"male\\\"\\n                    },\\n                    {\\n                        \\\"operator\\\": \\\"eq\\\",\\n                        \\\"property_name\\\": \\\"format\\\",\\n                        \\\"property_value\\\": \\\"Sprint\\\"\\n                    }\\n                ],\\n                \\\"timeframe\\\": \\\"this_8_years\\\",\\n                \\\"timezone\\\": null,\\n                \\\"event_collection\\\": \\\"results\\\",\\n                \\\"optional\\\": false,\\n                \\\"inverted\\\": false\\n            }\\n        ],\\n        \\\"actors\\\": [\\n            null,\\n            [\\n                \\\"Alistair Brownlee\\\",\\n                \\\"Jonathan Brownlee\\\",\\n                \\\"Mario Mola\\\"\\n            ]\\n        ],\\n        \\\"result\\\": [\\n            11,\\n            3\\n        ]\\n    }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","slug":"funnels-endpoint","title":"Funnels Endpoint"}

Funnels Endpoint


The [Statistics API now contains the ability to perform funnel analysis](https://developers.triathlon.org/docs/funnel). Much like the [example in the Data Explorer Funnels](https://developers.triathlon.org/blog/data-explorer-funnels) this allows a broader range of analysis to be completed with queries that would previously have taken some level of scripting to solve which can now be answered directly. The significant advantage to using the API over the data explorer is that the **with_actors** property is available whereby you may list athletes matching the selected funnel steps. Continuing on with the example of WTS wins over both Standard and Sprint distance a POST request to /statistics/funnel with a body as below and a 'Content-Type' header of application/json will yield the result. [block:code] { "codes": [ { "code": "{\n \"steps\": [\n {\n \"with_actors\": \"false\",\n \"actor_property\": \"athlete.name\",\n \"filters\": \"position,eq,1|athlete.gender,eq,male|format,eq,Standard\",\n \"timeframe\": \"this_8_years\",\n \"optional\": false,\n \"inverted\": false,\n \"collection\": \"results\"\n },\n {\n \"with_actors\": \"true\",\n \"actor_property\": \"athlete.name\",\n \"filters\": \"position,eq,1|athlete.gender,eq,male|format,eq,Sprint\",\n \"timeframe\": \"this_8_years\",\n \"optional\": false,\n \"inverted\": false,\n \"collection\": \"results\"\n }\n ]\n}", "language": "json" } ] } [/block] The result being that whilst 11 athletes have won a standard distance race only 3 of those have also won a Sprint distance race (namely both Brownlees and Mario Mola). [block:code] { "codes": [ { "code": "{\n \"code\": 200,\n \"status\": \"success\",\n \"data\": {\n \"steps\": [\n {\n \"with_actors\": false,\n \"actor_property\": \"athlete.name\",\n \"filters\": [\n {\n \"operator\": \"eq\",\n \"property_name\": \"position\",\n \"property_value\": 1\n },\n {\n \"operator\": \"eq\",\n \"property_name\": \"athlete.gender\",\n \"property_value\": \"male\"\n },\n {\n \"operator\": \"eq\",\n \"property_name\": \"format\",\n \"property_value\": \"Standard\"\n }\n ],\n \"timeframe\": \"this_8_years\",\n \"timezone\": null,\n \"event_collection\": \"results\",\n \"optional\": false,\n \"inverted\": false\n },\n {\n \"with_actors\": true,\n \"actor_property\": \"athlete.name\",\n \"filters\": [\n {\n \"operator\": \"eq\",\n \"property_name\": \"position\",\n \"property_value\": 1\n },\n {\n \"operator\": \"eq\",\n \"property_name\": \"athlete.gender\",\n \"property_value\": \"male\"\n },\n {\n \"operator\": \"eq\",\n \"property_name\": \"format\",\n \"property_value\": \"Sprint\"\n }\n ],\n \"timeframe\": \"this_8_years\",\n \"timezone\": null,\n \"event_collection\": \"results\",\n \"optional\": false,\n \"inverted\": false\n }\n ],\n \"actors\": [\n null,\n [\n \"Alistair Brownlee\",\n \"Jonathan Brownlee\",\n \"Mario Mola\"\n ]\n ],\n \"result\": [\n 11,\n 3\n ]\n }\n}", "language": "json" } ] } [/block]
added
Funnels Endpoint at /statistics/funnels