{"__v":0,"_id":"566731f5d784a70d00397cd4","category":{"__v":9,"_id":"55773a6ce6063e0d00481380","pages":["55773a9fe6063e0d00481381","5638e57daaddb90d00c75fd1","564a61684cd0521700523ebf","564a629ceed7de0d003671d3","564a631a4721851900a675dc","564a63974721851900a675e4","564a63e8eed7de0d003671d7","564a9eb4e5d9d61700d57fe7","566731f5d784a70d00397cd4"],"project":"55773a5ba042551900b002cb","version":"55773a5ba042551900b002ce","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-06-09T19:11:40.967Z","from_sync":false,"order":9,"slug":"statistics-api","title":"Statistics API"},"editedParams":true,"editedParams2":true,"parentDoc":null,"project":"55773a5ba042551900b002cb","user":"546d17e2eb9cfd1400dd4529","version":{"__v":17,"_id":"55773a5ba042551900b002ce","project":"55773a5ba042551900b002cb","createdAt":"2015-06-09T19:11:23.764Z","releaseDate":"2015-06-09T19:11:23.764Z","categories":["55773a5ca042551900b002cf","55773a6ce6063e0d00481380","55773ab007e7110d001043ec","55773abaa042551900b002d5","55773ac207e7110d001043ed","55773acb07e7110d001043ee","55773ad3a042551900b002d6","55773adce6063e0d00481383","55773ae4a042551900b002d7","55773af307e7110d001043ef","55773af907e7110d001043f0","55773b0407e7110d001043f1","563a4f7ad25e8919005f3f39","563a4fcaa19edf0d00972321","564a70dc4cd0521700523edf","564b797bcc472d0d00da9435","564b855b766d4923004e1fd1"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"Motherboard","version_clean":"1.0.0","version":"1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-12-08T19:39:33.116Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[]},"method":"post","results":{"codes":[{"name":"","code":"{\n   \"code\":200,\n   \"status\":\"success\",\n   \"data\":{\n      \"actors\":[\n         [\n            \"Bevan Docherty\",\n            \"Jan Frodeno\",\n            \"Joao Silva\",\n            \"Jarrod Shoemaker\",\n            \"Jonathan Brownlee\",\n            \"Stuart Hayes\",\n            \"Mario Mola\",\n            \"Alistair Brownlee\",\n            \"Javier Gomez Noya\",\n            \"Brad Kahlefeldt\",\n            \"Steffen Justus\"\n         ],\n         [\n            \"Alistair Brownlee\",\n            \"Mario Mola\",\n            \"Jonathan Brownlee\"\n         ]\n      ],\n      \"steps\":[\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\":\"format\",\n                  \"property_value\":\"Standard\"\n               },\n               {\n                  \"operator\":\"eq\",\n                  \"property_name\":\"athlete.gender\",\n                  \"property_value\":\"male\"\n               }\n            ],\n            \"timeframe\":\"this_100_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\":\"format\",\n                  \"property_value\":\"Sprint\"\n               },\n               {\n                  \"operator\":\"eq\",\n                  \"property_name\":\"athlete.gender\",\n                  \"property_value\":\"male\"\n               }\n            ],\n            \"timeframe\":\"this_100_years\",\n            \"timezone\":null,\n            \"event_collection\":\"results\",\n            \"optional\":false,\n            \"inverted\":false\n         }\n      ],\n      \"result\":[\n         11,\n         3\n      ]\n   }\n}","language":"json","status":200}]},"settings":"","auth":"required","params":[{"_id":"566731f5d784a70d00397cd5","ref":"","in":"body","required":true,"desc":"The steps to include in the analysis","default":"","type":"array_object","name":"steps"}],"url":"/statistics/funnel"},"isReference":true,"order":5,"body":"The **Funnel** endpoint allows [funnel type queries](https://developers.triathlon.org/blog/data-explorer-funnels) to be performed against the Statistics API.\n\nYou should send data as a JSON string in the POST body with an accompanying 'Content-Type' header of application/json. The steps parameter is required and is a list of all steps to be included in the funnel analysis.\n\nThe returned **result** object contains an array of the number of matching results that meet the filter criteria.\n\nIf the **with_actors** property is specified a list of matching actors is returned so in the above example you can see Alistair Brownlee, Mario Mola and Jonathan Brownlee are the athletes meeting all conditions.\n\nThe **steps** parameter must contain an array of step objects as outlined below which should be sent in the body of the request. You may have as many steps in the analysis as you desire.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"steps\\\": [\\n\\t    {\\n\\t\\t    \\\"with_actors\\\": \\\"false\\\",\\n\\t\\t    \\\"actor_property\\\": \\\"athlete.name\\\",\\n\\t\\t    \\\"filters\\\": \\\"position,eq,1|athlete.gender,eq,male|format,eq,Standard\\\",\\n\\t\\t    \\\"timeframe\\\": \\\"this_7_years\\\",\\n\\t\\t    \\\"optional\\\": false,\\n\\t\\t    \\\"inverted\\\": false,\\n        \\\"collection\\\": \\\"results\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t    \\\"with_actors\\\": \\\"true\\\",\\n\\t\\t    \\\"actor_property\\\": \\\"athlete.name\\\",\\n\\t\\t    \\\"filters\\\": \\\"position,eq,1|athlete.gender,eq,male|format,eq,Sprint\\\",\\n\\t\\t    \\\"timeframe\\\": \\\"this_7_years\\\",\\n\\t\\t    \\\"optional\\\": false,\\n\\t\\t    \\\"inverted\\\": false,\\n        \\\"collection\\\": \\\"results\\\"\\n\\t\\t}\\n\\t]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Step Parameters\"\n}\n[/block]\nEach step accepts the following parameters:\n\n* **with_actors** - A boolean value that instructs the funnel to return a list of actor_property values for this step (defaults to false)\n* **actor_property** - (required) Specifies the name of the property to use as a unique identifier (defaults to athlete.id)\n* **filters** - A pipe delimited list of [filters](https://developers.triathlon.org/docs/statistics-api-overview#filters) to be applied to the step\n* **timeframe** - A [timeframe](https://developers.triathlon.org/docs/statistics-api-overview#timeframe) to perform the analysis (defaults to this_100_years)\n* **collection** - A collection to perform the analysis on (defaults to results)\n* **optional** - A boolean value that instructs the funnel to ignore the effects of this step on subsequent steps (defaults to false)\n* **inverted** - A boolean value that excludes events matching this step (defaults to false)\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"The first step of a funnel can be neither inverted nor made optional\"\n}\n[/block]","excerpt":"","slug":"funnel","type":"endpoint","title":"Funnel"}

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

steps:
required
array of objects
The steps to include in the analysis

Result Format


Documentation

The **Funnel** endpoint allows [funnel type queries](https://developers.triathlon.org/blog/data-explorer-funnels) to be performed against the Statistics API. You should send data as a JSON string in the POST body with an accompanying 'Content-Type' header of application/json. The steps parameter is required and is a list of all steps to be included in the funnel analysis. The returned **result** object contains an array of the number of matching results that meet the filter criteria. If the **with_actors** property is specified a list of matching actors is returned so in the above example you can see Alistair Brownlee, Mario Mola and Jonathan Brownlee are the athletes meeting all conditions. The **steps** parameter must contain an array of step objects as outlined below which should be sent in the body of the request. You may have as many steps in the analysis as you desire. [block:code] { "codes": [ { "code": "{\n \"steps\": [\n\t {\n\t\t \"with_actors\": \"false\",\n\t\t \"actor_property\": \"athlete.name\",\n\t\t \"filters\": \"position,eq,1|athlete.gender,eq,male|format,eq,Standard\",\n\t\t \"timeframe\": \"this_7_years\",\n\t\t \"optional\": false,\n\t\t \"inverted\": false,\n \"collection\": \"results\"\n\t\t},\n\t\t{\n\t\t \"with_actors\": \"true\",\n\t\t \"actor_property\": \"athlete.name\",\n\t\t \"filters\": \"position,eq,1|athlete.gender,eq,male|format,eq,Sprint\",\n\t\t \"timeframe\": \"this_7_years\",\n\t\t \"optional\": false,\n\t\t \"inverted\": false,\n \"collection\": \"results\"\n\t\t}\n\t]\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "Step Parameters" } [/block] Each step accepts the following parameters: * **with_actors** - A boolean value that instructs the funnel to return a list of actor_property values for this step (defaults to false) * **actor_property** - (required) Specifies the name of the property to use as a unique identifier (defaults to athlete.id) * **filters** - A pipe delimited list of [filters](https://developers.triathlon.org/docs/statistics-api-overview#filters) to be applied to the step * **timeframe** - A [timeframe](https://developers.triathlon.org/docs/statistics-api-overview#timeframe) to perform the analysis (defaults to this_100_years) * **collection** - A collection to perform the analysis on (defaults to results) * **optional** - A boolean value that instructs the funnel to ignore the effects of this step on subsequent steps (defaults to false) * **inverted** - A boolean value that excludes events matching this step (defaults to false) [block:callout] { "type": "info", "title": "The first step of a funnel can be neither inverted nor made optional" } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}