[WordPress] 外掛分享: Power BI Embedded for WordPress

WordPress 外掛 Power BI Embedded for WordPress 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「Power BI Embedded for WordPress」是 2018-02-21 上架。 目前已經下架不再更新,不建議安裝使用。
  • 目前有 1000 個安裝啟用數。
  • 上一次更新是 2023-06-17,距離現在已有 687 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 5.0.0 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 7.0 以上。
  • 有 4 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

stegel | upnrunn | atlaspolicy |

外掛標籤

powerbi | powerbi-embedded | wordpress plugin |

內容簡介

這個 WordPress 外掛支援 Microsoft Power BI 嵌入,包括儀表板、報告、報告可視化、問答和圖塊。Power BI 是微軟的一套複雜的數據分析軟件和服務套餐。更多關於 Power BI 的信息可以在www.powerbi.com上找到。

您可以在 GitHub 上貢獻這個插件,連結在https://github.com/atlaspolicy/power-bi-embedded!

這個插件使用 Power BI REST API 存取各種類型的內容,並使用簡短代碼輕松在 WordPress 站點中嵌入它們。插件遵循微軟文檔中記錄的“應用程序擁有數據”程序。有關從微軟獲取更多如何嵌入 Power BI 內容的信息,請參閱https://docs.microsoft.com/zh-tw/power-bi/developer/embedding。

插件依賴於 Microsoft 的 JavaScript 庫來嵌入 Power BI,GitHub 鏈接為https://github.com/Microsoft/PowerBI-JavaScript。

要使用此插件,用戶必須先使用 Azure AD 註冊應用程序以嵌入 Power BI 內容。在https://docs.microsoft.com/zh-tw/power-bi/developer/register-app上查看有關如何註冊應用程序的更多信息。在註冊應用程序時,請記下您的用戶端 ID 和用戶端密碼。

外掛設置頁面

“應用程序擁有數據”程序要求單個主要的 Power BI Pro 賬戶控制訪問權限。這個賬戶的憑據一次配置在插件設置頁面上。插件將使用這些存儲的憑據對 Azure AD 進行身份驗證。

用戶名:Power BI Pro 主賬戶的電子郵件地址。
密碼:Power BI Pro 主賬戶的密碼。
用戶端 ID:您在 Azure AD 註冊的應用程序的用戶端 ID。
用戶端密碼:您在 Azure AD 註冊的應用程序的用戶端密碼。

在保存更改後,如果驗證成功,您就會在設置頁面上看到身份驗證狀態。一旦配置了插件,您就可以在 WordPress 站點中添加 Power BI 內容,並在任何地方嵌入它們。

插件還包括支持控制 Azure 上的 Power BI 嵌入資源。如果您正在嘗試通過禁用不使用的資源來控制成本,那麼這將非常有幫助。可以通過設置啟用時間和停用時間來控制每天的排程。如果您不需要禁用資源,則可以忽略此部分。

用於 Office 365 的 Azure Active Directory 中的租戶 ID 或目錄 ID:目錄 ID 在 Azure 管理門戶上的 Azure Active Directory 下的屬性部分中。
用於 Power BI 資源的訂閱 ID:從 Azure 管理門戶中直接讀取。
資源群組名稱:從 Azure 管理門戶中直接讀取。
資源名稱:從 Azure 管理門戶中直接讀取。

星期日/星期六:設定每天啟動和暫停資源的時間。

對於排程,建議您在 Web 伺服器上使用 cron,而不是 WP Cron。許多網站可以指導您使用 Web 伺服器而不是 WP Cron 的過程。例如,參見

原文外掛簡介

This WordPress plugin supports Microsoft Power BI Embedded, including dashboards, reports, report visuals, Q&A, and tiles. Power BI is a sophisticated data analytics software and service package from Microsoft. More information on Power BI is available at www.powerbi.com.
Contribute to this plugin on GitHub at https://github.com/atlaspolicy/power-bi-embedded!
This plugin uses the Power BI REST API to access various types of content and easily embed them on a WordPress site using a shortcode. The plugin follows the “app owns data” process as documented by Microsoft at https://docs.microsoft.com/en-us/power-bi/developer/embedding-content. See https://docs.microsoft.com/en-us/power-bi/developer/embedding for more information from Microsoft on how to Power BI embed content.
The plugin relies on Microsoft’s JavaScript library for embedding Power BI available on Github here: https://github.com/Microsoft/PowerBI-JavaScript.
In order to use this plugin, users must first register an app with Azure AD to embed Power BI content. See https://docs.microsoft.com/en-us/power-bi/developer/register-app for more information on how to register an app. Make sure to write down your Client ID and Client Secret when you register the app.
Plugin Settings Page
The “app owns data” process requires that a single, master Power BI Pro account controls access. The credentials for this account are configured one time on the plugin settings page. The plugin will authenticate against Azure AD with those stored credentials.

User name: Email address for the Power BI Pro master account.
Password: Password for the Power BI Pro master account.
Client ID: The Client ID for the app you registered with Azure AD.
Client Secret: The Client Secret for the app you registered with Azure AD.

After you save your changes, you’ll see the authentication status on the settings page if it worked. Once you’ve configured the plugin, you can now add Power BI content to your WordPress site and embed it wherever you want.
The plugin also includes support to control the Power BI Embedded resource on Azure. This can be really helpful if you’re trying to control costs by disabling the resource when it’s not in use. The scheduling can be controlled on a daily basis by setting the hour to enable and the hour to disable the resource. If you don’t need to disable the resource, then you can ignore this section.

Tenant ID or Directory ID under Azure Active Directory for Office 365: The Directory ID is under the Properties section of the Azure Active Directory on the Azure portal.
Subscription ID for Power BI Resource: Read directly from Azure portal.
Resource Group Name: Read directly from the Azure portal.
Resource Name: Read directly from the Azure portal.

Sunday/Saturday: Set the time to start and pause the resource on a daily basis.
For scheduling, it is recommended to use cron on your web server instead of WP Cron. Many websites exist to walk you through the process of using your web server instead of WP Cron. For example, see https://www.nextscripts.com/tutorials/wp-cron-scheduling-tasks-in-wordpress.

Power BI Content
The plugin uses a custom content type for each Power BI component to embed (dashboard, report, etc.). Go to “All Power BI Items” to add a new component.

Embed Type: Report, Report Visual, Q&A, Dashboard, Tile.

The Embed Type determines the remaining fields to fill out.
Report

Report Mode: View, Edit, Create
Report ID: Enter the unique identifier for the report. You can find the identifier by viewing a report in the Power BI Service. The identifier is in the URL.
Group ID: Enter the unique identifier for the group. You can find the identifier by viewing a dashboard or report in the Power BI Service. The identifier is in the URL.
Dataset ID: Enter the unique identifier for the dataset. You can find the identifier by viewing a dashboard in the Power BI Service. The identifier is in the URL. This is only needed for Create Mode.

Report Visual

Report ID: Enter the unique identifier for the report. You can find the identifier by viewing a report in the Power BI Service. The identifier is in the URL.
Group ID: Enter the unique identifier for the group. You can find the identifier by viewing a dashboard or report in the Power BI Service. The identifier is in the URL.
Page Name: Enter the unique identifier for the Page. You can find the identifier by viewing the page within a report in the Power BI Service. The identifier is in the URL.
Visual Name: The Visual Name can be retrieved using the GetVisuals method on the Page object.

Q&A

Q&A Mode: Show Q&A, Show Q&A with predefined question, Show answer only with predefined question
Q&A Input Question: Only necessary for “Show Q&A with predefined question” and “Show answer only with predefined question”
Group ID: Enter the unique identifier for the group. You can find the identifier by viewing a dashboard or report in the Power BI Service. The identifier is in the URL.
Dataset ID: Enter the unique identifier for the dataset. You can find the identifier by viewing a dashboard in the Power BI Service. The identifier is in the URL. This is only needed for Create Mode.

Dashboard

Dashboard ID: Enter the unique identifier for the dashboard. You can find the identifier by viewing a dashboard in the Power BI Service. The identifier is in the URL.
Group ID: Enter the unique identifier for the group. You can find the identifier by viewing a dashboard or report in the Power BI Service. The identifier is in the URL.

Tile

Dashboard ID: Enter the unique identifier for the dashboard. You can find the identifier by viewing a dashboard in the Power BI Service. The identifier is in the URL.
Group ID: Enter the unique identifier for the group. You can find the identifier by viewing a dashboard or report in the Power BI Service. The identifier is in the URL.
Tile ID: Enter the unique identifier for the dashboard tile. You can find the identifier by entering the focus mode for a tile when viewing a dashboard in the Power BI Service. The identifier is in the URL.

Other Settings for Power BI Content
You can also configure how the content is embedded including whether to show the filter pane or page navigation along with the language (defines the language Power BI uses for localization and locale format (defines the text formatting that powerBI uses for dates, currency, etc.). Finally, you can set the default width and height for the container in pixels or as a percentage.
Important Cache Notes and Fixes
When installing or upgrading this plugin you may run into display errors when using a CDN, cache plugin or security plugin. The following can be done to fix most caching/security plugin issues.

Manually purge/clear your plugin and browser cache
Whitelist the /wp-json path in your security plugin, cache or CDN settings to allow updated data to always be returned.
Lower your cache timer to 10 hours or less to allow WP nonces to refresh properly

Embedding Content in WordPress
Once the Power BI content is created in WordPress, you can embed it anywhere with a shortcode. The shortcode accepts the unique identifier for the Power BI content (visible from “All Power BI Items”) and an optional width and height to customize the size of the content where it is being embedded, if you want to override the default width and/or height for the content.
[powerbi id=X width=X height=X]

You also can use a shortcode to display content based on the Power BI Embedded resource state. This shortcode allows you to show content when the resource is active and other content when the resource is paused.
Display the content when resource is active.
[powerbi_resource]
Resource is active.
[/powerbi_resource]

Display the content when resource is paused.
[powerbi_resource state="Paused"]
Resource is paused.
[/powerbi_resource]

Learn more about states. https://docs.microsoft.com/en-us/rest/api/power-bi-embedded/capacities/getdetails#state
Filters
The plugin is able to filter Reports using the [https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters](Report Level Filters) API functions in PowerBI embedded. To use filters you need to pass the filter object in the querystring as a serialized JSON string.
Example
var relatedFilterObj = [{
$schema : "http://powerbi.com/product/schema#basic",
target : {
table : "Countries",
column : "Country",
},
operator : "=",
values : [country]

}
];

var relatedURL = pageURL + "?filters=" + encodeURIComponent(JSON.stringify(relatedFilterObj));

Applying Slicers

The plugin can also apply Slicers before the report loads based on passing stringified JSON in the URL. Read more about [Slicers](https://github.com/Microsoft/PowerBI-JavaScript/wiki/Slicers)

Example
var slicers = [
{
selector : {
$schema: "http://powerbi.com/product/schema#visualSelector",
visualName: "fee64d853d2c3e579085"
},
state : {
filters : [
{
$schema: "http://powerbi.com/product/schema#basic",
target : {
table : "Tools",
column : "Tool"
},
operator: "In",
values: ["Information Operations"],
}
]
}
}
];

var relatedURL = pageURL + "?slicers=" + encodeURIComponent(JSON.stringify(slicers));

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Power BI Embedded for WordPress」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.0 | 1.0.1 | 1.0.2 | 1.1.0 | 1.1.1 | 1.1.2 | 1.1.3 | 1.1.4 | 1.1.5 | 1.1.6 | 1.1.7 | trunk |

延伸相關外掛(你可能也想知道)

  • WordPress + Microsoft Office 365 / Azure AD | LOGIN 》r WordPress plugins and themes, using the WPO365 | REST API plugin , Customize the login experience with your own logo and message, and create you...。
  • PowerBI Embed Reports 》tics and this plugin, PowerBI Embed Reports, enables seamless embedding of Microsoft Power BI content into your WordPress site. The plugin utilizes...。
  • All-in-One Microsoft Office 365 Apps + Azure/EntraID Login 》WordPress Login with Azure (Azure SSO) 外掛允許您使用您的 Azure 帳戶憑證 ( Azure AD / Azure B2C / Office 365 ) 登入到您的 WordPress 網站上,並實現...。
  • Code formatter for PowerBI 》這是一款針對 DAX 和 M code (PowerQuery、PowerBI 和 Excel PowerPivot 中使用的程式語言)進行格式化和美化的 WordPress 外掛程式。, , M code(PowerQuer...。

文章
Filter
Apply Filters
Mastodon