Dimension Filter
In etracker Analytics, the data records of a report can be filtered based on the desired value within an activated dimension. The parameter attributeFilter, which can only be applied to segments and dimensions, allows the data of a report to be called filtered using the REST API.
The structure is as follows:
Parameter | attributeFilter |
---|---|
Description | Includes the filter characteristics in the form of a JSON array. |
JSON array structure | [ { "input":"SUCHBEGRIFF", "type":"contains", "attributeId":"ATTRIBUT_ID", "filterType":"simple" } ] |
JSON array description | • input: Contains the substring which needs to be included in the dimension or segment. • attributId: Dimension or segment which should be filtered. • type and filterType do not need to be adapted |
Permitted characters | The following characters are permitted for input: • Additional letters from all languages which are included in unicode • all numbers: 0 - 9 • special characters: § % $ ( ) = ? € @ , . ! & + - ^ ° _ | [ ] / * { } : \ • space |
Note:
Correct usage requires URL encoding of the JSON array.
URL-encoded example:
%5B%7B%22input%22%3A%22KEYWORD%22%2C%22type%22%3A%22contains%22%2C%22attributeId%22%3A%22ATTRIBUT_ID%22%2C%22filterType%22%3A%22simple%22%7D%5D
The following example demonstrates the use of the parameter in a query:
https://ws.etracker.com/api/v6/report/EAPage/data?startDate=2020-11-29&endDate=2020-12-06&displayType=grouped&twig=fold%3A&attributes=page_name&sortColumn=unique_visits&sortOrder=1&attributeFilter=%5B%7B%22input%22%3A%22homepage%22%2C%22type%22%3A%22contains%22%2C%22attributeId%22%3A%22page_name%22%2C%22filterType%22%3A%22simple%22%7D%5D
If multiple dimensions or segments inside a display are to be filtered, the additional entries are to be added to the JSON array accordingly.
[
{
"input":"KEYWORD",
"type":"contains",
"attributeId":"ATTRIBUT_ID",
"filterType":"simple"
},
{
"input":"KEYWORD",
"type":"contains",
"attributeId":"ATTRIBUT_ID",
"filterType":"simple"
},
{
"input":"KEYWORD",
"type":"contains",
"attributeId":"ATTRIBUT_ID",
"filterType":"simple"
}
]
Key Figure Filter
Analogue to the dimension filter, the data of a report can also be filtered on the basis of a key figure and retrieved via the REST API. The filter parameters can be set for a figure using the parameter “keyFigureFilter”:
Parameter | keyfigureFilter |
---|---|
Description | Includes the filter characteristics in the form of a JSON array. |
JSON array structure | [ { "input":100, "type":"lt", "filter":"include", "keyfigure":"unique_visits" } ] |
JSON array description | • input: Enthält den „Integer Wert“, der auf die Kennzahl als Filter angewendet werden soll • type: erlaubt sind "lt" = lower than, "gt" = greater than oder "eq" = equal • filter: include oder exclude • keyfigure: Kennzahlen-ID |
Permitted characters | „input“ only allows set of natural numbers |
Note: As with the dimension filter, correct use requires URL encoding of the JSON array.
Example:
%5B%7B%22input%22%3A100%2C%22type%22%3A%22lt%22%2C%22filter%22%3A%22include%22%2C%22keyfigure%22%3A%22unique_visits%22%7D%5D
Example of the use of the parameter in a query:
https://ws.etracker.com/api/v6/report/EAPage/data?startDate=2021-03-06&endDate=2021-03-12&displayType=grouped&twig=fold%3A&attributes=page_name&sortColumn=unique_visits&sortOrder=1&attributeFilter=&keyfigureFilter=%5B%7B%22input%22%3A100%2C%22type%22%3A%22lt%22%2C%22filter%22%3A%22include%22%2C%22keyfigure%22%3A%22unique_visits%22%7D%5D&limit=101&requestSource=apollo_application
If a filter is to be applied to several key figures, the JSONArray must be extended accordingly:
1 | [{“input”:int, “type”:”lt”|”gt”|”eq”, “filter”:”include”, “keyfigure”:”Kennzahlen-ID”}] |
The following is an example of several key figure filters (decoded):
http://ws.etracker.com/api/v6/report/EAPage/data?startDate=2021-03-07&endDate=2021-03-13&displayType=grouped&twig=fold:&attributes=page_name&sortColumn=unique_visits&sortOrder=1&attributeFilter=&keyfigureFilter=[{„input“:13,“type“:“lt“,“filter“:“include“,“keyfigure“:“unique_visitors“},{„input“:23,“type“:“eq“,“filter“:“include“,“keyfigure“:“page_impressions“}]&limit=101&requestSource=apollo_application
It is also possible to define an upper and lower limit for a key figure filter:
http://ws.etracker.com/api/v6/report/EAPage/data?startDate=2021-03-07&endDate=2021-03-13&displayType=grouped&twig=fold:&attributes=page_name&sortColumn=unique_visits&sortOrder=1&attributeFilter=&keyfigureFilter=[{„input“:13,“type“:“gt“,“filter“:“include“,“keyfigure“:“unique_visitors“},{„input“:50,“type“:“lt“,“filter“:“include“,“keyfigure“:“unique_visitors“}]&limit=101&requestSource=apollo_application