Data Explorer API


The only technical requirement to make the Data Explorer API work is to use:


To run the installation, open a terminal or command prompt, navigate to the repository where you want to install Composer and enter:

composer install

bin/console server:run

Query Form


You have to configure your environment to connect to a google cloud service account.

And then, in your bash profile file (or ask an admin sys to get a json file if you don’t have the appropriate access rights), enter:

export GOOGLE_APPLICATION_CREDENTIALS="/home/user/Downloads/service-account-file.json"

Url : http://localhost:8000/queryform/

Url :

Definition list

Method Route Auth
GET /queryform/definition/dimensions true
GET /queryform/definition/metrics true

Query api

Here is an exemple of a query string for the API:

Method Route Auth
GET /queryform?params true

Parameters of the query api

You can combine the metrics and dimensions available in the query form:

Name Is Array Definition
account no ID of the account owner of the data.
dimensions yes List of the dimensions you want to have in the report result.
metrics yes List of the metrics you want to have in the report result.
startDate no Start date. Format : YYYYMMDD or a valid timestamp
endDate no End date. Format : YYYYMMDD or a valid timestamp
filtersValue no List of filters of dimensions or metrics.
You have to use the right format as explained in the next section.
rowConditions no List of conditions in session of dimensions or metrics.
You have to use the right format as explained in the next section.
sortMetrics yes List of the metrics of dimensions you want to sort on.
You have to prefix - before the name to sort DESC.
maxValue no Number max of results to fetch.

Format of the filterValue parameter

You can filter the results of your report results using the following syntax:


In this example, you want results for the url containing "abtasty" on Chrome browser for which there is more than 100 sessions.

Format of the rowConditions parameter

You can get rows which contains a certain condition, like a hit with a specific type or custom variables inside the session. It works like a filterValue parameter:


In this example, you want results for sessions which have received an eventAction of value CustomAction.

Operations for the dimensions

Operator Definition
== Equals to
=@ Contains the text
=~ Regular Expression

Operations for the metrics

Operator Definition
== Equals number
<= Less than number or equal
>= Greater than number or equal
< Less than number
> More than number

Using the query form to generate a reporting

This route is just an adapter for reporting. It turns the result of both query api results into a single json object valid for reporting.

    "success": true,
    "data": {
        "0": {
            "campaign_id": 305461,
            "variation_id": 0,
            "variation_name": "Original",
            "is_reference_variation": true,
            "totals": {
                "reference_metric": 0,
                "goal_metric": 0
            "days": []
        "403175": {
            "campaign_id": 305461,
            "variation_id": 403175,
            "variation_name": "Variation 1",
            "is_reference_variation": false,
            "totals": {
                "reference_metric": 2708,
                "goal_metric": 2708
            "days": {
                "20180708": {
                    "reference_metric": 27,
                    "goal_metric": 27
                "20180709": {
                    "reference_metric": 266,
                    "goal_metric": 266
Method Route Auth
GET /queryform/reporting?params true

Parameters to send :

Operator Definition
account The account ID
campaign The campaign ID
referenceMetric The reference metric you want to compare to (ex: users)
goalMetric The goal metric you want to evaluate (ex: users)
startDate (optional) The start date
endDate (optional) The end date
goalFiltersValue Acts like filtersValue for query api but only for the goal metric
customFiltersValue Acts like filtersValue for query api but for both metrics
rowConditions Acts like rowConditions for query api

Reporting - Bayesian

Example of how you will get the data for each variation :

"bayesian_data": {
    "posterior": {
        "median": 0,
        "confidence_interval": [
    "lift": {
        "median": 0,
        "confidence_interval": [
    "difference_probability": 0,
    "better_than_original": false

When conversion (meaning conversionRate available in each set of data) is possible between the referenceMetric and the goalMetric. We can apply bayesian analysis to get the reliability rate.

Conversion is possible for the following input reference and goal metrics cases :

Reference metric Goal metric
all metrics must have the same name
users users, revisit, newUsers, uniqueTransactions, uniqueEvents, uniquePageviews, unique…
sessions sessions, bounces

Reporting - Mann Whitney U

Example of results you will get in each variation for those query inputs:

"mwu_data": {
    "revenue_per_visitor": 21.36933353333333,
    "p_value": {
        "difference": 0.9709114414996768,
        "less": 0.4854557207498384,
        "greater": 1

To calculate the reliability of a reporting data, transactions metrics have to apply an algorithm called Mann Whitney U. This algorithm is enabled only for some inputs.

Calculation name Input reference Metric Input goal metric
Average basket users revenuePerTransaction
Revenue per visitor users revenuePerUser
Total revenue users transactionsRevenue
Average nb products users itemsPerPurchase
Average products price itemsQuantity productRevenuePerPurchase

Api documentation online

Status Code

Status code Description
[200] Returned when successful
[400] Returned when one or more parameters are invalid
[401] Returned when authentication is required
[403] Returned when you have not the necessary permissions for the resource
[404] Returned when resource could not be found