BI Integration (Power BI)
You can connect Power BI directly to the Statistics API and build dashboards on live usage data.
The script below uses the hosts for whichever environment you pick here.
Example Power BI Dashboard
Below is an example of what a dashboard might look like:

This dashboard includes:
- Total number of editor documents
- Counts grouped by template and date
- Document volume per hour
Integration Script (Power Query M)
(page as text) =>
let
client_id = "your-client-id",
client_secret = "your-client-secret",
token_url = "https://identity-v2.metaforce.net/connect/token",
api_url = "https://api.statistics-v2.metaforce.net/analytics?pageSize=1000&pageNumber=" & page,
scope = "api.external",
GetAccessToken = () =>
let
Body = Text.ToBinary("grant_type=client_credentials" &
"&client_id=" & client_id &
"&client_secret=" & client_secret &
"&scope=" & scope),
TokenResponse = Json.Document(Web.Contents(token_url,
[Content = Body, Headers = [#"Content-Type" = "application/x-www-form-urlencoded"]])),
AccessToken = TokenResponse[access_token]
in AccessToken,
AccessAPI = (accessToken as text) =>
let
ApiResponse = Json.Document(Web.Contents(api_url,
[Headers = [Authorization = "Bearer " & accessToken]])),
Data = ApiResponse[data]
in Data,
token = GetAccessToken(),
data = AccessAPI(token),
Table1 = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
Expanded = Table.ExpandRecordColumn(Table1, "Column1",
{"event", "system", "date", "hour", "template", "source", "distribution", "environment", "area", "count"},
{"event", "system", "date", "hour", "template", "source", "distribution", "environment", "area", "count"})
in Expanded
The function takes one page. Call it in a loop to pull the rest and append them into a single table.