Title: New Relic Reporting for WordPress
Author: 10up
Published: <strong>2016 年 12 月 2 日</strong>
Last modified: 2025 年 8 月 11 日

---

搜尋外掛

![](https://ps.w.org/wp-newrelic/assets/banner-772x250.png?rev=2968950)

![](https://ps.w.org/wp-newrelic/assets/icon.svg?rev=2968950)

# New Relic Reporting for WordPress

 由 [10up](https://profiles.wordpress.org/10up/) 開發

[下載](https://downloads.wordpress.org/plugin/wp-newrelic.1.3.3.zip)

 * [詳細資料](https://tw.wordpress.org/plugins/wp-newrelic/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/wp-newrelic/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/wp-newrelic/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/wp-newrelic/#developers)

 [技術支援](https://wordpress.org/support/plugin/wp-newrelic/)

## 外掛說明

WP New Relic (WPNR) is designed to use with [New Relic APM](https://newrelic.com/application-monitoring)
which uses [New Relic PHP Agent API](https://docs.newrelic.com/docs/agents/php-agent/configuration/php-agent-api)
to properly augment existing metrics with valuable WordPress details such as templates,
users, request type, transaction names etc. This plugin is tested with PHP Agent
10.19.0.9.

New Relic is a trademark of New Relic, Inc.

#### Admin Settings

After activating the plugin, You will see a new option named **New Relic** under
the Tools menu in your WordPress Dashboard. If you are running WordPress in Network
Mode, the settings page will be found in your Network Dashboard.

Capture URL Parameters: If Capture URLs setting is enabled, it will capture URL 
parameters for displaying in transaction traces.

#### Basic Config

By default plugin will setup 3 configs.
 – newrelic.appname – newrelic.capture_params–
newrelic.framework (value is wordpress)

appname and capture_params config can be override using **wp_nr_config filter**.**
wp_nr_setup_config** action hook can also be used to setup any extra config.

#### New Relic Custom Attributes

Certain useful custom attrribute (just like WordPress post meta) will be set for
each event which can provide additional information using key-value pair. You can
query events and filter them using these attributes in New Relic Insights. See [NRQL reference](https://docs.newrelic.com/docs/insights/new-relic-insights/using-new-relic-query-language/nrql-reference)
for more details on how to query events.

 1.  **User**
 2.  User attribute is getting set using [newrelic_set_user_attributes](https://docs.newrelic.com/docs/agents/php-agent/configuration/php-agent-api#api-set-user-attributes).
     If user is logged in, user ID will be set to user attribute and if not it will
     be set to **not-logged-in**.
      Ex: In New Relic Insights you can query transactions
     for non-logged in users as SELECT * FROM Transaction WHERE appName = ‘{appName}’
     AND user = ‘not-logged-in’
 3.  **Post ID**
 4.  For single post, post ID will be set via **post_id** custom parameter in transaction.
 5.  Ex: Get all transactions for a post ID 190.
 6.  SELECT * FROM Transaction WHERE appName = ‘{appName}’ AND post_id = ‘190’
 7.  One can also query for post view count for post 190.
 8.  SELECT count(*) FROM Transaction WHERE appName = ‘{appName}’ AND post_id = ‘190’
 9.  **Template**
 10. For each request, template being used getting set as **template** custom parameter
     in transaction.
 11. Ex: You can query all transactions for a particular template as following.
 12. SELECT * FROM Transaction WHERE appName = ‘{appName}’ AND template = ‘{Absolute
     Template Path}’
 13. **Theme**
 14. Current theme is getting set as **theme** custom parameter in transaction.
 15. Ex: Query all transactions for “Twenty Fifteen” theme.
 16. SELECT * FROM Transaction WHERE appName = ‘{appName}’ AND theme = ‘Twenty Fifteen’
 17. **Request type**
 18. There can be 3 type of requests namely web, ajax and cli. Current request type
     getting set as **request_type** custom parameter in transaction.
      Request type
     can be override using wp_nr_request_type filter.
 19. Ex: Get all transaction for “ajax” request type
 20. SELECT * FROM Transaction WHERE appName = ‘{appName}’ AND request_type = ‘ajax’
 21. **Transaction Name**
 22. Transaction name is getting set as per the main WP_Query parameters using [newrelic_name_transaction](https://docs.newrelic.com/docs/agents/php-agent/configuration/php-agent-api#api-name-wt).
     
     Possible values are Default Home Page, Front Page, Blog Page, Network Dashboard,
     Dashboard, Single – {post_type}, Page – {pagename}, Date Archive, Search Page,
     Feed, Archive – {post_type}, Category – {cat_name}, Tag – {tag_name}, Tax – {taxonomy}–{
     term}
 23. **Custom Error Logging**
 24. Using **wp_nr_log_errors** function, any plugin/theme can log errors/notices to
     New Relic for current transaction.
      Note: This function can be used more than 
     once but only last use will be considered to log the error to New Relic. It’s 
     limitation of [PHP Agent API](https://docs.newrelic.com/docs/agents/php-agent/configuration/php-agent-api#api-notice-error).
 25. **wp_nr_log_errors( ‘Error message’, Exception $exception );**
 26. **Runtime of async tasks**
 27. This plugin also tracks runtime of [gearman](https://github.com/10up/WP-Gears)
     async tasks. Gearman async task run for a particular hook and it’s runtime can
     be track using “wp_async_task-{hook}” custom attribute in New Relic Insights.

#### Issues

 1. **PHP version**
     PHP version 7.3.3 is known to cause issues with this plugin, updating
    to 7.3.11 or greater appears to resolve these issues. For more details, see [issue#39](https://github.com/10up/wp-newrelic/issues/39).
 2. **Have an issue to report?**
     If you identify any errors or have an idea for improving
    the plugin, please open an [issue](https://github.com/10up/wp-newrelic/issues?stage=open).
    We’re excited to see what the community thinks of this project, and we would love
    your input!

## 安裝方式

 1. First, you will need to [install and configure](https://docs.newrelic.com/docs/agents/php-agent/getting-started/new-relic-php)
    New Relic PHP agent on server.
 2. Activate the plugin in WordPress.
 3. Enjoy!

## 使用者評論

![](https://secure.gravatar.com/avatar/4373e171afae9085e81ebe5788ef331be49f212417f244896e5fd1a8000f2b42?
s=60&d=retro&r=g)

### 󠀁[Thank you!](https://wordpress.org/support/topic/thank-you-3520/)󠁿

 [rvscc](https://profiles.wordpress.org/rvscc/) 2024 年 4 月 9 日

This makes it easy to see in new relic admin, thank you!

![](https://secure.gravatar.com/avatar/3eaec2daced26ebc1e364cdf227aaec0e6220afa7fc1777ad8de0e97b30a4877?
s=60&d=retro&r=g)

### 󠀁[Much needed timesaver!](https://wordpress.org/support/topic/much-needed-timesaver/)󠁿

 [Kristof Loyens Quantum Leap](https://profiles.wordpress.org/quantum-leap/) 2024
年 1 月 5 日

Thanks for this. Saved a lot of time and hasstle!

![](https://secure.gravatar.com/avatar/c18228ab18d1c4bfbd6ca7344ee16b0cf962d9cfa12b8906bbb5d1f49bde935e?
s=60&d=retro&r=g)

### 󠀁[Works like a charm](https://wordpress.org/support/topic/works-like-a-charm-1199/)󠁿

 [MyThemeShop](https://profiles.wordpress.org/mythemeshop/) 2018 年 2 月 15 日

Just installed the plugin and it works like a charm with NewRelic’s service. Thank
you for developing this plugin.

![](https://secure.gravatar.com/avatar/ac62a9a56f3e2f435d38ad45be05aee18fa12241138a4faa6b2023bf5a0761fc?
s=60&d=retro&r=g)

### 󠀁[Essential added data](https://wordpress.org/support/topic/essential-added-data/)󠁿

 [Jake Goldman](https://profiles.wordpress.org/jakemgold/) 2017 年 7 月 13 日

I’m biased, since other members of my team built this, but using it for some clients
I’m serving, I can say that the added data – particularly around the page template
and user properties – saves significant time in diagnostics.

 [ 閱讀全部 4 則使用者評論 ](https://wordpress.org/support/plugin/wp-newrelic/reviews/)

## 參與者及開發者

以下人員參與了開源軟體〈New Relic Reporting for WordPress〉的開發相關工作。

參與者

 *   [ 10up ](https://profiles.wordpress.org/10up/)
 *   [ Ritesh Patel ](https://profiles.wordpress.org/ritteshpatel/)
 *   [ Thorsten Ott ](https://profiles.wordpress.org/tott/)
 *   [ oscarssanchez ](https://profiles.wordpress.org/oscarssanchez/)
 *   [ Jeffrey Paul ](https://profiles.wordpress.org/jeffpaul/)

[將〈New Relic Reporting for WordPress〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/wp-newrelic)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/wp-newrelic/)、
查看 [SVN 存放庫](https://plugins.svn.wordpress.org/wp-newrelic/)，或透過 [RSS](https://plugins.trac.wordpress.org/log/wp-newrelic/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/wp-newrelic/)。

## 變更記錄

#### 1.3.3 – 2024-06-26

**Note this release bumps the PHP minimum from 7.3.11 to 8.0 and the WordPress minimum
from 4.0 to 6.3.**
 * **Added:** Minimum PHP version check for 7.3.11 (props [@bmarshall511](https://github.com/bmarshall511),
[@Sidsector9](https://github.com/Sidsector9) via [#60](https://github.com/10up/wp-newrelic/pull/60)).***
Changed:** [Support Level](https://github.com/10up/wp-newrelic?tab=readme-ov-file#support-level)
downgraded from `Active` to `Stable` (props [@jeffpaul](https://github.com/jeffpaul),
[@dkotter](https://github.com/dkotter), [@felipeelia](https://github.com/felipeelia),
[@oscarssanchezz](https://github.com/oscarssanchezz) via [#65](https://github.com/10up/wp-newrelic/pull/65)).***
Changed:** Bump WordPress “tested up to” version 6.5 (props [@zamanq](https://github.com/zamanq),
[@jeffpaul](https://github.com/jeffpaul), [@oscarssanchezz](https://github.com/oscarssanchezz)
via [#58](https://github.com/10up/wp-newrelic/pull/58), [#66](https://github.com/10up/wp-newrelic/pull/66)).***
Fixed:** Improve compatibility with PHP 8.1 by replacing the deprecated `FILTER_SANITIZE_STRING`(
props [@burhandodhy](https://github.com/burhandodhy), [@jeffpaul](https://github.com/jeffpaul),
[@felipeelia](https://github.com/felipeelia), [Sven](https://tw.wordpress.org/plugins/wp-newrelic/venms@gmail.com?output_format=md)
via [#68](https://github.com/10up/wp-newrelic/pull/68)).

#### 1.3.2 – 2022-06-28

 * **Changed:** Bump WordPress version “tested up to” 6.0 (props [@lukecav](https://github.com/lukecav),
   [@burhandodhy](https://github.com/burhandodhy), [@jeffpaul](https://github.com/jeffpaul)
   via [#45](https://github.com/10up/wp-newrelic/pull/45), [#49](https://github.com/10up/wp-newrelic/pull/49)).

[View historical changelog details here](https://github.com/10up/wp-newrelic/blob/develop/CHANGELOG.md).

## 社群版外掛

這個外掛由社群人員開發及提供技術支援。 [參與這個外掛專案](https://github.com/10up/wp-newrelic/)

## 中繼資料

 *  版本 **1.3.3**
 *  最後更新 **8 個月前**
 *  啟用安裝數 **700+**
 *  WordPress 版本需求 ** 6.3 或更新版本 **
 *  已測試相容的 WordPress 版本 **6.8.5**
 *  PHP 版本需求 ** 8.0 或更新版本 **
 *  語言
 * [English (US)](https://wordpress.org/plugins/wp-newrelic/)
 *  [進階檢視](https://tw.wordpress.org/plugins/wp-newrelic/advanced/)

## 評分

 5 星，滿分為 5 星

 *  [  4 個 5 星使用者評論     ](https://wordpress.org/support/plugin/wp-newrelic/reviews/?filter=5)
 *  [  0 個 4 星使用者評論     ](https://wordpress.org/support/plugin/wp-newrelic/reviews/?filter=4)
 *  [  0 個 3 星使用者評論     ](https://wordpress.org/support/plugin/wp-newrelic/reviews/?filter=3)
 *  [  0 個 2 星使用者評論     ](https://wordpress.org/support/plugin/wp-newrelic/reviews/?filter=2)
 *  [  0 個 1 星使用者評論     ](https://wordpress.org/support/plugin/wp-newrelic/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/wp-newrelic/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/wp-newrelic/reviews/)

## 參與者

 *   [ 10up ](https://profiles.wordpress.org/10up/)
 *   [ Ritesh Patel ](https://profiles.wordpress.org/ritteshpatel/)
 *   [ Thorsten Ott ](https://profiles.wordpress.org/tott/)
 *   [ oscarssanchez ](https://profiles.wordpress.org/oscarssanchez/)
 *   [ Jeffrey Paul ](https://profiles.wordpress.org/jeffpaul/)

## 技術支援

使用者可在技術支援論壇提出意見反應或使用問題。

 [檢視技術支援論壇](https://wordpress.org/support/plugin/wp-newrelic/)