Chilkat Online Tools

Xojo / Braze Endpoints / Campaign Analytics

Back to Collection Items

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

Dim http As New Chilkat.Http
Dim success As Boolean

Dim queryParams As New Chilkat.JsonObject
success = queryParams.UpdateString("campaign_id","{{campaign_identifier}}")
success = queryParams.UpdateInt("length",7)
success = queryParams.UpdateString("ending_at","2020-06-28T23:59:59-5:00")

// Adds the "Authorization: Bearer {{api_key}}" header.
http.AuthToken = "{{api_key}}"

Dim resp As Chilkat.HttpResponse
resp = http.QuickRequestParams("GET","https://rest.iad-01.braze.com/campaigns/data_series",queryParams)
If (http.LastMethodSuccess = False) Then
    System.DebugLog(http.LastErrorText)
    Return
End If

System.DebugLog(Str(resp.StatusCode))
System.DebugLog(resp.BodyStr)

Curl Command

curl -G -d "campaign_id=%7B%7Bcampaign_identifier%7D%7D"
	-d "length=7"
	-d "ending_at=2020-06-28T23%3A59%3A59-5%3A00"
	-H "Authorization: Bearer {{api_key}}"
https://rest.iad-01.braze.com/campaigns/data_series

Postman Collection Item JSON

{
  "name": "Campaign Analytics",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Authorization",
        "value": "Bearer {{api_key}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "https://{{instance_url}}/campaigns/data_series?campaign_id={{campaign_identifier}}&length=7&ending_at=2020-06-28T23:59:59-5:00",
      "protocol": "https",
      "host": [
        "{{instance_url}}"
      ],
      "path": [
        "campaigns",
        "data_series"
      ],
      "query": [
        {
          "key": "campaign_id",
          "value": "{{campaign_identifier}}",
          "description": "(Required) String\n\nCampaign API identifier"
        },
        {
          "key": "length",
          "value": "7",
          "description": "(Required) Integer\n\nMax number of days before ending_at to include in the returned series - must be between 1 and 100 inclusive"
        },
        {
          "key": "ending_at",
          "value": "2020-06-28T23:59:59-5:00",
          "description": "(Optional) DateTime (ISO 8601 string)\n\nDate on which the data series should end - defaults to time of the request"
        }
      ]
    },
    "description": "This endpoint allows you to retrieve a daily series of various stats for a campaign over time. Data returned includes how many messages were sent, opened, clicked, converted, etc., broken down by message channel. \n\n### Components Used\n-[Campaign Identifier](https://www.braze.com/docs/api/identifier_types/)\n\n\n### Responses\n\n#### Multi-Channel Response\n\n```json\nContent-Type: application/json\nAuthorization: Bearer YOUR-REST-API-KEY\n{\n    \"message\": (required, string) the status of the export, returns 'success' when completed without errors,\n    \"data\" : [\n        {\n            \"time\" : (string) date as ISO 8601 date,\n            \"messages\" : {\n                \"ios_push\" : [\n                    {\n                      \"variation_name\": \"iOS_Push\",\n                      \"sent\" : (int),\n                      \"direct_opens\" : (int),\n                      \"total_opens\" : (int),\n                      \"bounces\" : (int),\n                      \"body_clicks\" : (int)\n                      \"revenue\": 0,\n                      \"unique_recipients\": 1,\n                      \"conversions\": 0,\n                      \"conversions_by_send_time\": 0,\n                      \"conversions1\": 0,\n                      \"conversions1_by_send_time\": 0,\n                      \"conversions2\": 0,\n                      \"conversions2_by_send_time\": 0,\n                      \"conversions3\": 0,\n                      \"conversions3_by_send_time\": 0,\n                      \"carousel_slide_[NUM]_[TITLE]_click\": (optional, int),\n                      \"notif_button_[NUM]_[TITLE]_click\": (optional, int)\n                    }\n                ],\n                \"android_push\" : [\n                    {\n                      \"sent\" : (int),\n                      \"direct_opens\" : (int),\n                      \"total_opens\" : (int),\n                      \"bounces\" : (int),\n                      \"body_clicks\" : (int)\n                    }\n                ],\n                \"webhook\": [\n                    {\n                      \"sent\": (int),\n                      \"errors\": (int)\n                    }\n                ],\n                \"email\" : [\n                    {\n                      \"sent\": (int),\n                      \"opens\": (int),\n                      \"unique_opens\": (int),\n                      \"clicks\": (int),\n                      \"unique_clicks\": (int),\n                      \"unsubscribes\": (int),\n                      \"bounces\": (int),\n                      \"delivered\": (int),\n                      \"reported_spam\": (int)\n                    }\n                ],\n                \"sms\" : [\n                  {\n                    \"sent\": (int),\n                    \"delivered\": (int),\n                    \"undelivered\": (int),\n                    \"delivery_failed\": (int)\n                  }\n                ]\n              },\n           \"conversions_by_send_time\": (optional, int),\n           \"conversions1_by_send_time\": (optional, int),\n           \"conversions2_by_send_time\": (optional, int),\n           \"conversions3_by_send_time\": (optional, int),\n           \"conversions\": (int),\n           \"conversions1\": (optional, int),\n           \"conversions2\": (optional, int),\n           \"conversions3\": (optional, int),\n           \"unique_recipients\": (int),\n           \"revenue\": (optional, float)\n        },\n        ...\n    ],\n    ...\n}\n```\n\n#### Multivariate Response\n\n```json\nContent-Type: application/json\nAuthorization: Bearer YOUR-REST-API-KEY\n{\n    \"data\" : [\n        {\n            \"time\" : (string) date as ISO 8601 date,\n            \"conversions\" : (int),\n            \"revenue\": (float),\n            \"conversions_by_send_time\": (int),\n            \"messages\" : {\n               \"trigger_in_app_message\": [{\n      \t\t\t\t\"variation_name\": (optional, string),\n      \t\t\t\t\"impressions\": (int),\n      \t\t\t\t\"clicks\": (int),\n      \t\t\t\t\"first_button_clicks\": (int),\n      \t\t\t\t\"second_button_clicks\": (int),\n      \t\t\t\t\"revenue\": (optional, float),,\n      \t\t\t\t\"unique_recipients\": (int),\n      \t\t\t\t\"conversions\": (optional, int),\n      \t\t\t\t\"conversions_by_send_time\": (optional, int),\n      \t\t\t\t\"conversions1\": (optional, int),\n      \t\t\t\t\"conversions1_by_send_time\": (optional, int),\n      \t\t\t\t\"conversions2\": (optional, int),\n      \t\t\t\t\"conversions2_by_send_time\": (optional, int),\n      \t\t\t\t\"conversions3\": (optional, int),\n      \t\t\t\t\"conversions3_by_send_time\": (optional, int)\n      \t\t\t}, {\n      \t\t\t\t\"variation_name\": (optional, string),\n      \t\t\t\t\"impressions\": (int),\n      \t\t\t\t\"clicks\": (int),\n      \t\t\t\t\"first_button_clicks\": (int),\n      \t\t\t\t\"second_button_clicks\": (int),\n      \t\t\t\t\"revenue\": (optional, float),,\n      \t\t\t\t\"unique_recipients\": (int),\n      \t\t\t\t\"conversions\": (optional, int),\n      \t\t\t\t\"conversions_by_send_time\": (optional, int),\n      \t\t\t\t\"conversions1\": (optional, int),\n      \t\t\t\t\"conversions1_by_send_time\": (optional, int),\n      \t\t\t\t\"conversions2\": (optional, int),\n      \t\t\t\t\"conversions2_by_send_time\": (optional, int),\n      \t\t\t\t\"conversions3\": (optional, int).\n      \t\t\t\t\"conversions3_by_send_time\": (optional, int)\n      \t\t\t}, {\n      \t\t\t\t\"variation_name\": (optional, string),\n      \t\t\t\t\"revenue\": (optional, float),,\n      \t\t\t\t\"unique_recipients\": (int),\n      \t\t\t\t\"conversions\": (optional, int),\n      \t\t\t\t\"conversions_by_send_time\": (optional, int),\n      \t\t\t\t\"conversions1\": (optional, int),\n      \t\t\t\t\"conversions1_by_send_time\": (optional, int),\n      \t\t\t\t\"conversions2\": (optional, int),\n      \t\t\t\t\"conversions2_by_send_time\": (optional, int),\n      \t\t\t\t\"conversions3\": (optional, int),\n      \t\t\t\t\"conversions3_by_send_time\": (optional, int),\n      \t\t\t\t\"enrolled\": (optional, int)\n      \t\t\t}]\n      \t\t},\n      \t\t\"conversions_by_send_time\": (optional, int),\n      \t\t\"conversions1_by_send_time\": (optional, int),\n      \t\t\"conversions2_by_send_time\": (optional, int),\n      \t\t\"conversions3_by_send_time\": (optional, int),\n      \t\t\"conversions\": (optional, int,\n      \t\t\"conversions1\": (optional, int),\n      \t\t\"conversions2\": (optional, int),\n      \t\t\"conversions3\": (optional, int),\n      \t\t\"unique_recipients\": (int),\n      \t\t\"revenue\": (optional, float)\n         }],\n         ...\n}\n```\n\nPossible message types are `email`, `in_app_message`, `webhook`, `android_push`, `apple_push`, `kindle_push`, `web_push`, `windows_phone8_push`, and `windows_universal_push`. All push message types will have the same statistics shown for `android_push` above."
  },
  "response": [
  ]
}