Embedded Reports

Journey Analytics enables you to embed your Journey Analytics reports in any web page framework, while enjoying the full benefit of Journey Analytics visualization options.

Embedded User and Sessions report

Get Your Journey Analytics User API Token

To get your Journey Analytics API token click the Profile icon at the top right of the window and copy your API Token.

Get the Report ID

  1. Create/Open a Report in Journey Analytics. See Creating Reports.
  2. In the Report Editing window, copy the report ID which is the last part of its URL.

    Report ID in the URL

Prepare the Journey Analytics Report Request

The following are the mandatory parts of a request for embedding a Journey Analytics report script in your site.

Use the retrieved User API Token as described in Step 2 in, and the retrieved Report ID, as described in Step 3.

Method: Post

Request URI: https://app.cooladata.com/1/embeddedReports

Content Type: application/json

Payload:

{ 
  "apiToken": "<apiToken>", 
  "reportId": "<reportId>"
}

The response to the request above is a single report token according to the parameters of the request. A token expires immediately after being used or within five minutes, if it is not used.

{
  "token": "<tokenId>"
}

More Options for the Journey Analytics payload request

Here are a few more options that you can include in your Journey Analytics report request in order to get back the visualization and data that you want.

Dashboard ID

Including a dashboard ID in the request returns the same view as is currently displayed in this dashboard of this user (the user is determined by the API token). This means that the report script represents the same date range and filters as in the dashboard.

To get the dashboard ID, open the dashboard and then copy the dashboard ID from the right of its URL:

https://app.cooladata.com/#/dashboards/56a63385e4b0e8504dbe8770

Note: If the report has an active date range or filter override, then the report's date range and filters are used. Otherwise, the dashboard's date range and filters are used, as set by the user of this API token.

Date Range

If the request does not include a specific date range, then the report's date range is returned.

Adding a date range to the request takes precedence over the date range defined in the Journey Analytics console for this report and dashboard.

To specify a date range, use one of the following options:

  • Date Range Expression:
    "dateRange": {
      "mode": "TODAY | YESTERDAY | LAST_7_DAYS | LAST_30_DAYS | LAST_90_DAYS | CURRENT_WEEK | CURRENT_MONTH"
      }

– OR –

  • Custom Range: Epoch milliseconds – you can send any millisecond during the date. Journey Analytics converts it to the first second of the Start date and the last second of the End date.Start date (actualFrom): is converted to "YYYY-MM_DD 00:00:00".End date (actualTo): is converted to "YYYY-MM-DD 23:59:59".

    "dateRange": {
     "mode": "CUSTOM",
     "actualFrom": 1439275953685,
     "actualTo": 1439275953685
     }

Filters

If the request does not include a specific filter (as described below), then the report's filters determine the data that is returned.

Adding filters to the request takes precedence over the filter defined in the Journey Analytics console for this report and dashboard. Multiple conditions can be entered in the slicer section of the request. All conditions can either be specified with an AND or an OR Boolean operator.

Specify the name of an event property, an operator and a value.

"slicer": {
  "bitwiseOperator": "AND",
  "conditions": [{
    "property": "property_name",
    "operator": "INTEGER_EQUALS | INTEGER_NOT_EQUALS | STRING_EQUALS | STRING_NOT_EQUALS | INTEGER_IN_LIST | INTEGER_NOT_IN_LIST | STRING_IN_LIST | STRING_NOT_IN_LIST | CONTAINS | NOT_CONTAINS | EXISTS | NOT_EXISTS | REGEX | AT_LEAST | NO_MORE_THAN | BETWEEN | TIME_BETWEEN | LATER_THAN | EARLIER_THAN",
    "values": ["value1", "value2"]
    }]
  }

To use segmentation in filters, add the following condition:

{
    "property": "COOLADATA_SEGMENT",
    "operator": "IS_IN_SEGMENT_TABLE | NOT_IN_SEGMENT_TABLE"
    "values": ["segment_name"]
}

You can use multiple segment conditions in the same query.

Fetch the Journey Analytics Report

Use the report token that you received (as described above) in the following API to fetch the report visualization (Method – GET). Then, embed it in any webpage framework.

https://app.cooladata.com/reports/<reportToken>

Example

Using all the above options.

Request the Report Token:

{
    "apiToken": "aRG1DbdzN0FC1z8Ii7VUjFwlQvaogiBm6LE6oxFs",
    "reportId": "55cca707e4b03f8a48f9299f",
    "documentId": "55bf81c2e4b0d15ad906453e",
    "dateRange": {
        "mode": "LAST_7_DAYS"
        },
    "slicer": {
        bitwiseOperator: "AND",
        "conditions": [{
            "property": "browser_name",
            "operator": "STRING_IN_LIST",
            "values": ["Chrome", "Android Browser"]
            }]
}

Response:

{
    "token": "55d2f2cee4b067eb33fe778"
}

Fetch the report:

https://app.cooladata.com/reports/55d2f2cee4b067eb33fe778