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

Step 1 – Create a Report in CoolaData

Create a report in the CoolaData administration console.

Step 2 – Get Your CoolaData User API Token

To get your CoolaData API token:

Open your workspace in the CoolaData Administrator console and click on the Profile profile icon in the top right of the window. Then, copy your user token from the API Token field.

5-2

Step 3 – Get the Report’s Token

  • Get the ID of the Report to Be Embedded
  • Prepare the CoolaData Report Request – Mandatory
  • More Options for the CoolaData Report Request
  • Receive the Report Token

Get the ID of the Report to Be Embedded

To get the ID of the report to be embedded:

  1. In the CoolaData Administrator console, select Dashboards 5-3.
  2. Do one of the following to open the editing window of the report that you want to embed –
    • Select Reports reports button and click on a report to open it.

– OR –

    • In a dashboard, click the Edit edit-1 button in the top right corner of the report.

5-5

  1. In the Report Editing window, copy the report ID which is the last part of its URL. !!!!!!!!!!!!!!!!!!!!!!!

5-6

Prepare the CoolaData Report Request – Mandatory

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

Method – Post

Request URL – https://app.cooladata.com/1/embeddedReports

Content Type – application/json

Payload

Use the retrieved CoolaData User API Token (apiToken), as described in Step 2 – Get Your CoolaData User API Token.

Use the retrieved Report ID (reportId), as described above.

More Options for the CoolaData Report Request

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

  • Date Range
  • Filters
  • Dashboard (Document) ID
  • Here’s an example using all the options

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 CoolaData console for this report and dashboard.

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

Date Range Expression

– OR –
Custom Range

Use Epoch milliseconds.

Start date (actualFrom) is converted to the day’s beginning (YYYY-MM_DD 00:00:00).

End date (actualTo) is converted to the day’s end (YYYY-MM-DD 23:59:59).

To make it easy, you can send any millisecond in the Start date or End date and CoolaData converts it to the first second of that day or the last second accordingly.

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 CoolaData 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.

To see the names of event properties:

In the CoolaData Administrator console, select Dashboards 5-3 and then click the 5-7 button, which displays all the properties and events in your project.

Dashboard (Document) 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:

Display the dashboard and then copy the dashboard ID from the right of its URL.

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.

Here’s an example using all the options

Receive the Report Token

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.

Step 4 – Fetch the CoolaData 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.

For example,

This is an example of an embedded report –

5-8

 

Print Friendly