Skip to content
Get Help

Query API Recipes

Overview ​

This recipe book provides practical examples for common Query API use cases. Each recipe includes a complete curl request and a sample JSON response to help you quickly build your own queries. You can adapt these examples to fit your specific needs.

Read our Query API Overview page for more information about using the Query API.


Total installs ​

This query retrieves the total number of installs per day over a specified time period. This is useful for getting a high-level overview of your app's install trends.

Request ​

curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-11-29T00:00:00-08:00",
  "end_date": "2017-12-05T23:59:59-08:00",
  "data_source": "eo_install",
  "granularity": "day",
  "dimensions": [
    "timestamp"
  ],
  "filters": {
    "!user_data_platform": [
      "ROBOT"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"

Response ​

json
{
  "results": [
    {
      "timestamp": "2017-12-05T08:00:00.000Z",
      "result": {
        "unique_count": 246
      }
    },
    {
      "timestamp": "2017-12-04T08:00:00.000Z",
      "result": {
        "unique_count": 302
      }
    },
    {
      "timestamp": "2017-12-03T08:00:00.000Z",
      "result": {
        "unique_count": 277
      }
    },
    {
      "timestamp": "2017-12-02T08:00:00.000Z",
      "result": {
        "unique_count": 300
      }
    },
    {
      "timestamp": "2017-12-01T08:00:00.000Z",
      "result": {
        "unique_count": 264
      }
    },
    {
      "timestamp": "2017-11-30T08:00:00.000Z",
      "result": {
        "unique_count": 208
      }
    },
    {
      "timestamp": "2017-11-29T08:00:00.000Z",
      "result": {
        "unique_count": 225
      }
    }
  ],
  "paging": {
    "total_count": 7
  }
}

Attributed installs ​

This query retrieves the number of attributed installs per day. This is useful for understanding how many installs your marketing efforts are driving.

Request ​

curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-11-29T00:00:00-08:00",
  "end_date": "2017-12-05T23:59:59-08:00",
  "data_source": "eo_install",
  "granularity": "day",
  "dimensions": [
    "timestamp"
  ],
  "filters": {
    "!user_data_platform": [
      "ROBOT"
    ],
    "!days_from_last_attributed_touch_to_event": [
      "null"
    ]
  },
  "aggregation": "total_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"

Response ​

{
  "results": [
    {
      "timestamp": "2017-12-05T08:00:00.000Z",
      "result": {
        "total_count": 248
      }
    },
    {
      "timestamp": "2017-12-04T08:00:00.000Z",
      "result": {
        "total_count": 296
      }
    },
    {
      "timestamp": "2017-12-03T08:00:00.000Z",
      "result": {
        "total_count": 284
      }
    },
    ...
  ],
  "paging": {
    "total_count": 7
  }
}

Attributed installs by campaign ​

This query retrieves the number of attributed installs, broken down by campaign. This is useful for comparing the performance of different campaigns.

Request ​

curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-11-29T00:00:00-08:00",
  "end_date": "2017-12-05T23:59:59-08:00",
  "data_source": "eo_install",
  "granularity": "day",
  "dimensions": [
    "last_attributed_touch_data_tilde_campaign"
  ],
  "filters": {
    "!user_data_platform": [
      "ROBOT"
    ],
    "!days_from_last_attributed_touch_to_event": [
      "null"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"

Response ​

{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_campaign": null,
        "unique_count": 171
      },
      "timestamp": "2017-12-01T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_campaign": null,
        "unique_count": 158
      },
      "timestamp": "2017-12-04T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_campaign": null,
        "unique_count": 157
      },
      "timestamp": "2017-12-02T08:00:00.000Z"
    },
    ...
  ],
  "paging": {
    "total_count": 56
  }
}

Attributed installs for a specific campaign ​

This query retrieves the number of attributed installs for a single, specified campaign. This is useful for drilling down into the performance of a particular campaign.

Request ​

curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-08T00:00:00-08:00",
  "end_date": "2017-12-14T23:59:59-08:00",
  "data_source": "eo_install",
  "granularity": "day",
  "dimensions": [
    "last_attributed_touch_data_tilde_campaign"
  ],
  "filters": {
    "!user_data_platform": [
      "ROBOT"
    ],
    "!days_from_last_attributed_touch_to_event": [
      "null"
    ],
    "last_attributed_touch_data_tilde_campaign": [
      "09slukxuhqn8f821"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"

Response ​

json
{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_campaign": "09slukxuhqn8f821",
        "unique_count": 1
      },
      "timestamp": "2017-12-11T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 1
  }
}

Attributed installs for multiple campaigns ​

This query retrieves the number of attributed installs for a specified set of campaigns. This is useful for analyzing the performance of a group of related campaigns.

Request ​

curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-08T00:00:00-08:00",
  "end_date": "2017-12-14T23:59:59-08:00",
  "data_source": "eo_install",
  "granularity": "day",
  "dimensions": [
    "last_attributed_touch_data_tilde_campaign"
  ],
  "filters": {
    "!user_data_platform": [
      "ROBOT"
    ],
    "!days_from_last_attributed_touch_to_event": [
      "null"
    ],
    "last_attributed_touch_data_tilde_campaign": [
      "09slukxuhqn8f821",
      "0x230602kyi18keo"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"

Response ​

json
{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_campaign": "09slukxuhqn8f821",
        "unique_count": 1
      },
      "timestamp": "2017-12-11T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_campaign": "0x230602kyi18keo",
        "unique_count": 1
      },
      "timestamp": "2017-12-13T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 2
  }
}

Querying click flow data ​

This recipe shows how to query the full click-to-install/open funnel. Because different event types are stored in separate data sources, multiple API requests are required to get the complete picture. The following queries show how to retrieve each piece of the funnel.

Complete click flow summary ​

To get a complete view of the click flow, you need to query six different data sources. The following requests show how to query each source. You can then aggregate the results in your own system.

Request 1: Clicks (eo_click) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "YOUR_BRANCH_SECRET",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_click",
  "granularity": "all",
  "dimensions": [
    "user_data_platform",
    "from_desktop"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_WEB",
      "ANDROID_WEB",
      "DESKTOP_WEB"
    ],
    "!last_attributed_touch_data_plus_current_feature": [
      "MOBILE_DEEPVIEWS",
      "DESKTOP_DEEPVIEWS"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 1 ​
json
{
  "results": [
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "user_data_platform": "ANDROID_WEB",
        "from_desktop": "false",
        "unique_count": 683
      }
    },
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "user_data_platform": "IOS_WEB",
        "from_desktop": "false",
        "unique_count": 675
      }
    },
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "user_data_platform": "ANDROID_WEB",
        "from_desktop": "true",
        "unique_count": 49
      }
    },
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "user_data_platform": "IOS_WEB",
        "from_desktop": "true",
        "unique_count": 44
      }
    },
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "user_data_platform": "DESKTOP_WEB",
        "from_desktop": "false",
        "unique_count": 17
      }
    }
  ],
  "paging": {
    "total_count": 5
  }
}
Request 2: Web to app redirects (eo_web_to_app_auto_redirect) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_web_to_app_auto_redirect",
  "granularity": "all",
  "dimensions": [
    "user_data_platform",
    "from_desktop"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_WEB",
      "ANDROID_WEB",
      "DESKTOP_WEB"
    ],
    "!last_attributed_touch_data_plus_current_feature": [
      "MOBILE_DEEPVIEWS",
      "DESKTOP_DEEPVIEWS"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 2 ​
json
{
  "results": [
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "user_data_platform": "IOS_WEB",
        "from_desktop": "false",
        "unique_count": 6
      }
    }
  ],
  "paging": {
    "total_count": 1
  }
}
Request 3: SMS sent (eo_sms_sent) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_sms_sent",
  "granularity": "all",
  "dimensions": [
    "user_data_platform"
  ],
  "filters": {
    "user_data_platform": [
      "DESKTOP_WEB"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 3 ​
json
{
  "results": [
    {
      "result": {
        "user_data_platform": "DESKTOP_WEB",
        "unique_count": 17
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 1
  }
}
Request 4: Installs (eo_install) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_install",
  "granularity": "all",
  "dimensions": [
    "user_data_platform",
    "from_desktop"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_APP",
      "ANDROID_APP"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 4 ​
json
{
  "results": [
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "user_data_platform": "ANDROID_APP",
        "from_desktop": "false",
        "unique_count": 657
      }
    },
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "user_data_platform": "IOS_APP",
        "from_desktop": "false",
        "unique_count": 473
      }
    },
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "user_data_platform": "ANDROID_APP",
        "from_desktop": "true",
        "unique_count": 49
      }
    },
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "user_data_platform": "IOS_APP",
        "from_desktop": "true",
        "unique_count": 46
      }
    }
  ],
  "paging": {
    "total_count": 4
  }
}
Request 5: Opens (eo_open) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_open",
  "granularity": "all",
  "dimensions": [
    "user_data_platform",
    "from_desktop"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_APP",
      "ANDROID_APP"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 5 ​
json
{
  "results": [
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "user_data_platform": "IOS_APP",
        "from_desktop": "false",
        "unique_count": 436
      }
    },
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "user_data_platform": "ANDROID_APP",
        "from_desktop": "false",
        "unique_count": 395
      }
    }
  ],
  "paging": {
    "total_count": 2
  }
}
Request 6: Reinstalls (eo_reinstall) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_reinstall",
  "granularity": "all",
  "dimensions": [
    "user_data_platform",
    "from_desktop"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_APP",
      "ANDROID_APP"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 6 ​
json
{
  "results": [
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "user_data_platform": "IOS_APP",
        "from_desktop": "false",
        "unique_count": 361
      }
    },
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "user_data_platform": "ANDROID_APP",
        "from_desktop": "false",
        "unique_count": 283
      }
    }
  ],
  "paging": {
    "total_count": 2
  }
}

Filtering by campaign ​

You can add filters to any of the above queries to narrow down the results. This example shows how to filter the eo_click data source to a specific feature, journeys.

Request ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_click",
  "granularity": "all",
  "dimensions": [
    "user_data_platform",
    "from_desktop"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_WEB",
      "ANDROID_WEB",
      "DESKTOP_WEB"
    ],
    "!last_attributed_touch_data_plus_current_feature": [
      "MOBILE_DEEPVIEWS",
      "DESKTOP_DEEPVIEWS"
    ],
    "last_attributed_touch_data_tilde_feature": [
      "journeys"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response ​
json
{
  "results": [
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "user_data_platform": "ANDROID_WEB",
        "from_desktop": "false",
        "unique_count": 167
      }
    },
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "user_data_platform": "IOS_WEB",
        "from_desktop": "false",
        "unique_count": 166
      }
    }
  ],
  "paging": {
    "total_count": 2
  }
}

This example shows how to filter the eo_click data source to a specific Quick Link by using its ID. You can find the Quick Link ID in the URL of the link's stats page in Branch.

Request ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-14T00:00:00-08:00",
  "end_date": "2017-12-20T23:59:59-08:00",
  "data_source": "eo_click",
  "granularity": "all",
  "dimensions": [
    "user_data_platform",
    "from_desktop"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_WEB",
      "ANDROID_WEB",
      "DESKTOP_WEB"
    ],
    "!last_attributed_touch_data_plus_current_feature": [
      "MOBILE_DEEPVIEWS",
      "DESKTOP_DEEPVIEWS"
    ],
    "last_attributed_touch_data_tilde_id": [
      "271026075193177506"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response ​
json
{
  "results": [
    {
      "timestamp": "2017-12-14T08:00:00.000Z",
      "result": {
        "user_data_platform": "IOS_WEB",
        "from_desktop": "false",
        "unique_count": 1
      }
    }
  ],
  "paging": {
    "total_count": 1
  }
}

Querying Journeys data ​

This recipe shows how to query the full Journeys funnel, from CTA views to installs and opens. Because different event types are stored in separate data sources, multiple API requests are required to get the complete picture. The following queries show how to retrieve each piece of the funnel.

Complete Journeys funnel ​

To get a complete view of the Journeys funnel, you need to query six different data sources. The following requests show how to query each source. You can then aggregate the results in your own system.

Request 1: CTA views (eo_branch_cta_view) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_branch_cta_view",
  "granularity": "all",
  "dimensions": [
    "user_data_platform"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_WEB",
      "ANDROID_WEB"
    ],
    "last_attributed_touch_data_plus_current_feature": [
      "MOBILE_JOURNEYS"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 1 ​
json
{
  "results": [
    {
      "result": {
        "user_data_platform": "IOS_WEB",
        "unique_count": 406
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "user_data_platform": "ANDROID_WEB",
        "unique_count": 390
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 2
  }
}
Request 2: Clicks (eo_click) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_click",
  "granularity": "all",
  "dimensions": [
    "user_data_platform"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_WEB",
      "ANDROID_WEB"
    ],
    "last_attributed_touch_data_plus_current_feature": [
      "MOBILE_JOURNEYS"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 2 ​
json
{
  "results": [
    {
      "result": {
        "user_data_platform": "ANDROID_WEB",
        "unique_count": 167
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "user_data_platform": "IOS_WEB",
        "unique_count": 166
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 2
  }
}
Request 3: Web to app redirects (eo_web_to_app_auto_redirect) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_web_to_app_auto_redirect",
  "granularity": "all",
  "dimensions": [
    "user_data_platform"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_WEB",
      "ANDROID_WEB"
    ],
    "last_attributed_touch_data_plus_current_feature": [
      "MOBILE_JOURNEYS"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 3 ​
json
{
  "results": [],
  "paging": {
    "total_count": 0
  }
}
Request 4: Installs (eo_install) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_install",
  "granularity": "all",
  "dimensions": [
    "user_data_platform"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_APP",
      "ANDROID_APP"
    ],
    "last_attributed_touch_data_plus_via_features": [
      "MOBILE_JOURNEYS"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 4 ​
json
{
  "results": [
    {
      "result": {
        "user_data_platform": "ANDROID_APP",
        "unique_count": 167
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "user_data_platform": "IOS_APP",
        "unique_count": 10
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 2
  }
}
Request 5: Opens (eo_open) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_open",
  "granularity": "all",
  "dimensions": [
    "user_data_platform"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_APP",
      "ANDROID_APP"
    ],
    "last_attributed_touch_data_plus_via_features": [
      "MOBILE_JOURNEYS"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 5 ​
json
{
  "results": [],
  "paging": {
    "total_count": 0
  }
}
Request 6: Reinstalls (eo_reinstall) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_reinstall",
  "granularity": "all",
  "dimensions": [
    "user_data_platform"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_APP",
      "ANDROID_APP"
    ],
    "last_attributed_touch_data_plus_via_features": [
      "MOBILE_JOURNEYS"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 6 ​
json
{
  "results": [
    {
      "result": {
        "user_data_platform": "IOS_APP",
        "unique_count": 156
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "user_data_platform": "ANDROID_APP",
        "unique_count": 75
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 2
  }
}

Filtering by tag ​

You can add filters to any of the above queries to narrow down the results. This example shows how to filter the eo_branch_cta_view data source to a specific tag, tag1.

Request ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_branch_cta_view",
  "granularity": "all",
  "dimensions": [
    "user_data_platform"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_WEB",
      "ANDROID_WEB"
    ],
    "last_attributed_touch_data_plus_current_feature": [
      "MOBILE_JOURNEYS"
    ],
    "last_attributed_touch_data_tilde_tags": [
      "tag1"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response ​
json
{
  "results": [
    {
      "result": {
        "user_data_platform": "ANDROID_WEB",
        "unique_count": 373
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "user_data_platform": "IOS_WEB",
        "unique_count": 6
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 2
  }
}

Querying Deepviews data ​

This recipe shows how to query the full Deepviews funnel, from CTA views to installs and opens. Because different event types are stored in separate data sources, multiple API requests are required to get the complete picture. The following queries show how to retrieve each piece of the funnel.

Complete Deepviews funnel ​

To get a complete view of the Deepviews funnel, you need to query six different data sources. The following requests show how to query each source. You can then aggregate the results in your own system.

Request 1: CTA views (eo_branch_cta_view) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_branch_cta_view",
  "granularity": "all",
  "dimensions": [
    "user_data_platform"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_WEB",
      "ANDROID_WEB"
    ],
    "last_attributed_touch_data_plus_current_feature": [
      "MOBILE_DEEPVIEWS"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 1 ​
json
{
  "results": [
    {
      "result": {
        "user_data_platform": "ANDROID_WEB",
        "unique_count": 529
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "user_data_platform": "IOS_WEB",
        "unique_count": 361
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 2
  }
}
Request 2: Clicks (eo_click) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_click",
  "granularity": "all",
  "dimensions": [
    "user_data_platform"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_WEB",
      "ANDROID_WEB"
    ],
    "last_attributed_touch_data_plus_current_feature": [
      "MOBILE_DEEPVIEWS"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 2 ​
json
{
  "results": [
    {
      "result": {
        "user_data_platform": "ANDROID_WEB",
        "unique_count": 529
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "user_data_platform": "IOS_WEB",
        "unique_count": 440
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 2
  }
}
Request 3: Web to app redirects (eo_web_to_app_auto_redirect) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_web_to_app_auto_redirect",
  "granularity": "all",
  "dimensions": [
    "user_data_platform"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_WEB",
      "ANDROID_WEB"
    ],
    "last_attributed_touch_data_plus_current_feature": [
      "MOBILE_DEEPVIEWS"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 3 ​
json
{
  "results": [],
  "paging": {
    "total_count": 0
  }
}
Request 4: Installs (eo_install) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_install",
  "granularity": "all",
  "dimensions": [
    "user_data_platform"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_APP",
      "ANDROID_APP"
    ],
    "last_attributed_touch_data_plus_via_features": [
      "MOBILE_DEEPVIEWS"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 4 ​
json
{
  "results": [
    {
      "result": {
        "user_data_platform": "ANDROID_APP",
        "unique_count": 435
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "user_data_platform": "IOS_APP",
        "unique_count": 393
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 2
  }
}
Request 5: Opens (eo_open) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_open",
  "granularity": "all",
  "dimensions": [
    "user_data_platform"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_APP",
      "ANDROID_APP"
    ],
    "last_attributed_touch_data_plus_via_features": [
      "MOBILE_DEEPVIEWS"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 5 ​
json
{
  "results": [
    {
      "result": {
        "user_data_platform": "ANDROID_APP",
        "unique_count": 167
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "user_data_platform": "IOS_APP",
        "unique_count": 151
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 2
  }
}
Request 6: Reinstalls (eo_reinstall) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_reinstall",
  "granularity": "all",
  "dimensions": [
    "user_data_platform"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_APP",
      "ANDROID_APP"
    ],
    "last_attributed_touch_data_plus_via_features": [
      "MOBILE_DEEPVIEWS"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 6 ​
json
{
  "results": [
    {
      "result": {
        "user_data_platform": "ANDROID_APP",
        "unique_count": 8
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "user_data_platform": "IOS_APP",
        "unique_count": 1
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 2
  }
}

Filtering by stage ​

You can add filters to any of the above queries to narrow down the results. This example shows how to filter the eo_branch_cta_view data source to a specific stage, stage88.

Request ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_branch_cta_view",
  "granularity": "all",
  "dimensions": [
    "user_data_platform"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_WEB",
      "ANDROID_WEB"
    ],
    "last_attributed_touch_data_plus_current_feature": [
      "MOBILE_DEEPVIEWS"
    ],
    "last_attributed_touch_data_tilde_stage": [
      "stage88"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response ​
json
{
  "results": [
    {
      "result": {
        "user_data_platform": "ANDROID_WEB",
        "unique_count": 90
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "user_data_platform": "IOS_WEB",
        "unique_count": 86
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 2
  }
}

This recipe shows how to query performance data for specific Quick Links. You can filter by one or more link IDs to analyze clicks, opens, and installs driven by those links.

This query retrieves the total number of clicks for a specified list of Quick Link IDs. This is useful for comparing the performance of different links.

Request ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-14T00:00:00-08:00",
  "end_date": "2017-12-20T23:59:59-08:00",
  "data_source": "eo_click",
  "granularity": "all",
  "dimensions": [
    "last_attributed_touch_data_tilde_id"
  ],
  "filters": {
    "!last_attributed_touch_data_plus_current_feature": [
      "MOBILE_DEEPVIEWS",
      "DESKTOP_DEEPVIEWS"
    ],
    "last_attributed_touch_data_tilde_id": [
      "458794678159033945",
      "456130187302684655",
      "400390887617834597",
      "271026075193177506"
    ],
    "!user_data_platform": [
      "ROBOT"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response ​
json
{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_id": "458794678159033945",
        "unique_count": 150
      },
      "timestamp": "2017-12-14T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_id": "456130187302684655",
        "unique_count": 125
      },
      "timestamp": "2017-12-14T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_id": "400390887617834597",
        "unique_count": 100
      },
      "timestamp": "2017-12-14T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_id": "271026075193177506",
        "unique_count": 75
      },
      "timestamp": "2017-12-14T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 4
  }
}

Filtering by campaign ​

You can add a filter to any of the above queries to narrow down the results. This example shows how to filter Quick Link clicks by a specific campaign.

Request ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2025-08-01T00:00:00-08:00",
  "end_date": "2025-08-07T23:59:59-08:00",
  "data_source": "eo_click",
  "granularity": "all",
  "dimensions": [
    "last_attributed_touch_data_tilde_id"
  ],
  "filters": {
    "!last_attributed_touch_data_plus_current_feature": [
      "MOBILE_DEEPVIEWS",
      "DESKTOP_DEEPVIEWS"
    ],
    "last_attributed_touch_data_tilde_campaign": [
      "<YOUR_CAMPAIGN_NAME>"
    ],
    "!user_data_platform": [
      "ROBOT"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response ​
json
{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_id": "<YOUR_QUICK_LINK_ID_1>",
        "unique_count": 80
      },
      "timestamp": "2025-08-01T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_id": "<YOUR_QUICK_LINK_ID_2>",
        "unique_count": 65
      },
      "timestamp": "2025-08-01T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 2
  }
}

Querying Source Analytics data ​

This recipe shows how to query the full marketing funnel by source (for example, campaign). Because different event types are stored in separate data sources, multiple API requests are required to get the complete picture. The following queries show how to retrieve each piece of the funnel, which you can then aggregate by campaign.

Complete funnel by campaign ​

To get a complete view of the funnel, you need to query eight different data sources. The following requests show how to query each source. You can then aggregate the results in your own system.

Request 1: Clicks (eo_click) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2025-08-01T00:00:00-08:00",
  "end_date": "2025-08-07T23:59:59-08:00",
  "data_source": "eo_click",
  "granularity": "all",
  "dimensions": [
    "last_attributed_touch_data_tilde_campaign"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_WEB",
      "ANDROID_WEB",
      "DESKTOP_WEB"
    ],
    "!last_attributed_touch_data_plus_current_feature": [
      "MOBILE_DEEPVIEWS",
      "DESKTOP_DEEPVIEWS"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 1 ​
json
{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_campaign": "<YOUR_CAMPAIGN_NAME_1>",
        "unique_count": 495
      },
      "timestamp": "2025-08-01T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_campaign": "<YOUR_CAMPAIGN_NAME_2>",
        "unique_count": 490
      },
      "timestamp": "2025-08-01T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 5
  }
}
Request 2: Web to app redirects (eo_web_to_app_auto_redirect) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2025-08-01T00:00:00-08:00",
  "end_date": "2025-08-07T23:59:59-08:00",
  "data_source": "eo_web_to_app_auto_redirect",
  "granularity": "all",
  "dimensions": [
    "last_attributed_touch_data_tilde_campaign"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_WEB",
      "ANDROID_WEB",
      "DESKTOP_WEB"
    ],
    "!last_attributed_touch_data_plus_current_feature": [
      "MOBILE_DEEPVIEWS",
      "DESKTOP_DEEPVIEWS"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 2 ​
json
{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_campaign": "<YOUR_CAMPAIGN_NAME_1>",
        "unique_count": 5
      },
      "timestamp": "2025-08-01T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 2
  }
}
Request 3: Installs (eo_install) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2025-08-01T00:00:00-08:00",
  "end_date": "2025-08-07T23:59:59-08:00",
  "data_source": "eo_install",
  "granularity": "all",
  "dimensions": [
    "last_attributed_touch_data_tilde_campaign"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_APP",
      "ANDROID_APP"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 3 ​
json
{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_campaign": "<YOUR_CAMPAIGN_NAME_1>",
        "unique_count": 425
      },
      "timestamp": "2025-08-01T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_campaign": "<YOUR_CAMPAIGN_NAME_2>",
        "unique_count": 328
      },
      "timestamp": "2025-08-01T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 58
  }
}
Request 4: Opens (eo_open) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2025-08-01T00:00:00-08:00",
  "end_date": "2025-08-07T23:59:59-08:00",
  "data_source": "eo_open",
  "granularity": "all",
  "dimensions": [
    "last_attributed_touch_data_tilde_campaign"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_APP",
      "ANDROID_APP"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 4 ​
json
{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_campaign": "<YOUR_CAMPAIGN_NAME_1>",
        "unique_count": 312
      },
      "timestamp": "2025-08-01T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_campaign": "<YOUR_CAMPAIGN_NAME_2>",
        "unique_count": 284
      },
      "timestamp": "2025-08-01T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 25
  }
}
Request 5: Reinstalls (eo_reinstall) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2025-08-01T00:00:00-08:00",
  "end_date": "2025-08-07T23:59:59-08:00",
  "data_source": "eo_reinstall",
  "granularity": "all",
  "dimensions": [
    "last_attributed_touch_data_tilde_campaign"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_APP",
      "ANDROID_APP"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 5 ​
json
{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_campaign": "<YOUR_CAMPAIGN_NAME_1>",
        "unique_count": 237
      },
      "timestamp": "2025-08-01T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_campaign": "<YOUR_CAMPAIGN_NAME_2>",
        "unique_count": 123
      },
      "timestamp": "2025-08-01T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 24
  }
}
Request 6: Web sessions (eo_web_session_start) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2025-08-01T00:00:00-08:00",
  "end_date": "2025-08-07T23:59:59-08:00",
  "data_source": "eo_web_session_start",
  "granularity": "all",
  "dimensions": [
    "last_attributed_touch_data_tilde_campaign"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_APP",
      "ANDROID_APP",
      "DESKTOP_WEB"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 6 ​
json
{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_campaign": null,
        "unique_count": 15
      },
      "timestamp": "2025-08-01T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_campaign": "<YOUR_CAMPAIGN_NAME_1>",
        "unique_count": 1
      },
      "timestamp": "2025-08-01T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 2
  }
}
Request 7: Commerce event counts (eo_commerce_event) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2025-08-01T00:00:00-08:00",
  "end_date": "2025-08-07T23:59:59-08:00",
  "data_source": "eo_commerce_event",
  "granularity": "all",
  "dimensions": [
    "last_attributed_touch_data_tilde_campaign",
    "name"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_WEB",
      "ANDROID_WEB",
      "DESKTOP_WEB",
      "IOS_APP",
      "ANDROID_APP"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 7 ​
json
{
  "results": [
    {
      "timestamp": "2025-08-01T08:00:00.000Z",
      "result": {
        "last_attributed_touch_data_tilde_campaign": "<YOUR_CAMPAIGN_NAME_1>",
        "name": "ADD_TO_CART",
        "unique_count": 268
      }
    },
    {
      "timestamp": "2025-08-01T08:00:00.000Z",
      "result": {
        "last_attributed_touch_data_tilde_campaign": "<YOUR_CAMPAIGN_NAME_2>",
        "name": "PURCHASE",
        "unique_count": 169
      }
    }
  ],
  "paging": {
    "total_count": 32
  }
}
Request 8: Commerce event revenue (eo_commerce_event) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2025-08-01T00:00:00-08:00",
  "end_date": "2025-08-07T23:59:59-08:00",
  "data_source": "eo_commerce_event",
  "granularity": "all",
  "dimensions": [
    "last_attributed_touch_data_tilde_campaign",
    "name"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_WEB",
      "ANDROID_WEB",
      "DESKTOP_WEB",
      "IOS_APP",
      "ANDROID_APP"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "revenue"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 8 ​
json
{
  "results": [
    {
      "timestamp": "2025-08-01T08:00:00.000Z",
      "result": {
        "last_attributed_touch_data_tilde_campaign": "<YOUR_CAMPAIGN_NAME_1>",
        "revenue": 220439.25,
        "name": "PURCHASE"
      }
    },
    {
      "timestamp": "2025-08-01T08:00:00.000Z",
      "result": {
        "last_attributed_touch_data_tilde_campaign": "<YOUR_CAMPAIGN_NAME_2>",
        "revenue": 182050.36,
        "name": "PURCHASE"
      }
    }
  ],
  "paging": {
    "total_count": 32
  }
}

Filtering by ad partner ​

You can add filters to any of the above queries to narrow down the results. This example shows how to filter the eo_click data source to a specific ad partner, Taptica.

Request ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2025-08-01T00:00:00-08:00",
  "end_date": "2025-08-07T23:59:59-08:00",
  "data_source": "eo_click",
  "granularity": "all",
  "dimensions": [
    "last_attributed_touch_data_tilde_campaign"
  ],
  "filters": {
    "user_data_platform": [
      "IOS_WEB",
      "ANDROID_WEB",
      "DESKTOP_WEB"
    ],
    "!last_attributed_touch_data_plus_current_feature": [
      "MOBILE_DEEPVIEWS",
      "DESKTOP_DEEPVIEWS"
    ],
    "last_attributed_touch_data_tilde_advertising_partner_name": [
      "<AD_PARTNER_NAME>"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response ​
json
{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_campaign": "<CAMPAIGN_FROM_AD_PARTNER>",
        "unique_count": 495
      },
      "timestamp": "2025-08-01T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 1
  }
}

This recipe shows how to query ad performance trends over time, broken down by ad partner.

This query retrieves the number of installs per day, broken down by ad partner. This is useful for tracking the daily performance of your ad partners.

Request ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-11-29T00:00:00-08:00",
  "end_date": "2017-12-05T23:59:59-08:00",
  "data_source": "eo_install",
  "granularity": "day",
  "dimensions": "last_attributed_touch_data_tilde_advertising_partner_name",
  "filters": {
    "last_attributed_touch_data_tilde_feature": [
      "paid advertising"
    ],
    "!user_data_platform": [
      "ROBOT"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response ​
{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Taptica",
        "unique_count": 40
      },
      "timestamp": "2017-12-05T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Taptica",
        "unique_count": 37
      },
      "timestamp": "2017-12-01T08:00:00.000Z"
    },
    ...
  ],
  "paging": {
    "total_count": 20
  }
}

This query retrieves the number of installs per day for a specific platform (iOS), broken down by ad partner. This is useful for analyzing platform-specific performance.

Request ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-11-29T00:00:00-08:00",
  "end_date": "2017-12-05T23:59:59-08:00",
  "data_source": "eo_install",
  "granularity": "day",
  "dimensions": "last_attributed_touch_data_tilde_advertising_partner_name",
  "filters": {
    "last_attributed_touch_data_tilde_feature": [
      "paid advertising"
    ],
    "!user_data_platform": [
      "ROBOT"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ],
    "user_data_platform": [
      "IOS_APP"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response ​
{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Apple Search Ads",
        "unique_count": 26
      },
      "timestamp": "2017-12-02T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Apple Search Ads",
        "unique_count": 23
      },
      "timestamp": "2017-12-03T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Apple Search Ads",
        "unique_count": 22
      },
      "timestamp": "2017-12-04T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Applovin",
        "unique_count": 20
      },
      "timestamp": "2017-11-29T08:00:00.000Z"
    },
    ...
  ],
  "paging": {
    "total_count": 20
  }
}

Querying Ads Analytics events ​

This recipe shows how to query event data for your ad campaigns, broken down by ad partner. Because different event types are stored in separate data sources, multiple API requests are required to get the complete picture. The following queries show how to retrieve each piece of the funnel, which you can then aggregate by ad partner.

Complete funnel by ad partner ​

To get a complete view of the funnel, you need to query seven different data sources. The following requests show how to query each source. You can then aggregate the results in your own system.

Request 1: Clicks (eo_click) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_click",
  "granularity": "all",
  "dimensions": [
    "last_attributed_touch_data_tilde_advertising_partner_name"
  ],
  "filters": {
    "last_attributed_touch_data_tilde_feature": [
      "paid advertising"
    ],
    "!user_data_platform": [
      "ROBOT"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 1 ​
json
{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "A4G",
        "unique_count": 579
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Taptica",
        "unique_count": 507
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Apple Search Ads",
        "unique_count": 193
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Applovin",
        "unique_count": 30
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 4
  }
}
Request 2: Installs (eo_install) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_install",
  "granularity": "all",
  "dimensions": [
    "last_attributed_touch_data_tilde_advertising_partner_name"
  ],
  "filters": {
    "last_attributed_touch_data_tilde_feature": [
      "paid advertising"
    ],
    "!user_data_platform": [
      "ROBOT"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 2 ​
json
{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Taptica",
        "unique_count": 425
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "A4G",
        "unique_count": 328
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Applovin",
        "unique_count": 188
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Apple Search Ads",
        "unique_count": 66
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 4
  }
}
Request 3: Opens (eo_open) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_open",
  "granularity": "all",
  "dimensions": [
    "last_attributed_touch_data_tilde_advertising_partner_name"
  ],
  "filters": {
    "last_attributed_touch_data_tilde_feature": [
      "paid advertising"
    ],
    "!user_data_platform": [
      "ROBOT"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 3 ​
json
{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "A4G",
        "unique_count": 312
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Taptica",
        "unique_count": 284
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Apple Search Ads",
        "unique_count": 194
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Applovin",
        "unique_count": 54
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 4
  }
}
Request 4: Reinstalls (eo_reinstall) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_reinstall",
  "granularity": "all",
  "dimensions": [
    "last_attributed_touch_data_tilde_advertising_partner_name"
  ],
  "filters": {
    "last_attributed_touch_data_tilde_feature": [
      "paid advertising"
    ],
    "!user_data_platform": [
      "ROBOT"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 4 ​
json
{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "A4G",
        "unique_count": 123
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Taptica",
        "unique_count": 119
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Apple Search Ads",
        "unique_count": 108
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Applovin",
        "unique_count": 57
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 4
  }
}
Request 5: Web sessions (eo_web_session_start) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_web_session_start",
  "granularity": "all",
  "dimensions": [
    "last_attributed_touch_data_tilde_advertising_partner_name"
  ],
  "filters": {
    "last_attributed_touch_data_tilde_feature": [
      "paid advertising"
    ],
    "!user_data_platform": [
      "ROBOT"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 5 ​
json
{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Taptica",
        "unique_count": 190
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "A4G",
        "unique_count": 179
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    },
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Applovin",
        "unique_count": 60
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 3
  }
}
Request 6: Commerce event counts (eo_commerce_event) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_commerce_event",
  "granularity": "all",
  "dimensions": [
    "last_attributed_touch_data_tilde_advertising_partner_name",
    "name"
  ],
  "filters": {
    "last_attributed_touch_data_tilde_feature": [
      "paid advertising"
    ],
    "!user_data_platform": [
      "ROBOT"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 6 ​
json
{
  "results": [
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "A4G",
        "name": "PURCHASE",
        "unique_count": 169
      }
    },
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Apple Search Ads",
        "name": "PURCHASE",
        "unique_count": 154
      }
    },
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Taptica",
        "name": "PURCHASE",
        "unique_count": 131
      }
    },
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Applovin",
        "name": "PURCHASE",
        "unique_count": 122
      }
    }
  ],
  "paging": {
    "total_count": 4
  }
}
Request 7: Commerce event revenue (eo_commerce_event) ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_commerce_event",
  "granularity": "all",
  "dimensions": [
    "last_attributed_touch_data_tilde_advertising_partner_name",
    "name"
  ],
  "filters": {
    "last_attributed_touch_data_tilde_feature": [
      "paid advertising"
    ],
    "!user_data_platform": [
      "ROBOT"
    ],
    "!days_from_last_attributed_touch_to_event": [
      null
    ]
  },
  "aggregation": "revenue"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response 7 ​
json
{
  "results": [
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "revenue": 220439.25,
        "last_attributed_touch_data_tilde_advertising_partner_name": "A4G",
        "name": "PURCHASE"
      }
    },
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "revenue": 182050.36,
        "last_attributed_touch_data_tilde_advertising_partner_name": "Apple Search Ads",
        "name": "PURCHASE"
      }
    },
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "revenue": 170676.85,
        "last_attributed_touch_data_tilde_advertising_partner_name": "Taptica",
        "name": "PURCHASE"
      }
    },
    {
      "timestamp": "2017-12-07T08:00:00.000Z",
      "result": {
        "revenue": 100719.39,
        "last_attributed_touch_data_tilde_advertising_partner_name": "Applovin",
        "name": "PURCHASE"
      }
    }
  ],
  "paging": {
    "total_count": 4
  }
}

Filtering by ad partner ​

You can add filters to any of the above queries to narrow down the results. This example shows how to filter the eo_click data source to a specific ad partner, Taptica.

Request ​
curl
curl -X POST -H "Content-Type: application/json" -d '{
  "branch_key": "<YOUR_BRANCH_KEY>",
  "branch_secret": "<YOUR_BRANCH_SECRET>",
  "start_date": "2017-12-07T00:00:00-08:00",
  "end_date": "2017-12-13T23:59:59-08:00",
  "data_source": "eo_click",
  "granularity": "all",
  "dimensions": [
    "last_attributed_touch_data_tilde_advertising_partner_name"
  ],
  "filters": {
    "last_attributed_touch_data_tilde_feature": [
      "paid advertising"
    ],
    "!user_data_platform": [
      "ROBOT"
    ],
    "last_attributed_touch_data_tilde_advertising_partner_name": [
      "Taptica"
    ]
  },
  "aggregation": "unique_count"
}' "http://api.branch.io/v1/query/analytics?limit=100"
Response ​
json
{
  "results": [
    {
      "result": {
        "last_attributed_touch_data_tilde_advertising_partner_name": "Taptica",
        "unique_count": 507
      },
      "timestamp": "2017-12-07T08:00:00.000Z"
    }
  ],
  "paging": {
    "total_count": 1
  }
}