• EnglishEspañol日本語한국어Português
  • Log inStart now

Magento business insights

Our Magento business insights dashboard provides a comprehensive view of your Magento ecommerce application's performance. With the dashboard, you can easily track key business metrics like revenue at risk, orders at risk due to downtime, and poor system performance. You can also use the dashboard to diagnose issues in your app's performance and optimize your code.

Our Magento business insights dashboard gives you a central view of your Magento app data.

To start monitoring your Magento app in New Relic, follow these steps to send your app data to New Relic and view it in the Magento business insights dashboard.

Install the infrastructure agent

Our infrastructure agent monitors your host and reports metrics such as CPU usage, memory usage, storage usage, disk usage, and network traffic.

To install the agent, choose one of these installation methods:

Install the PHP agent

Our PHP agent reports application and browser-related metrics like AJAX performance, error rate, duration, core web vitals, and throughput.

To install the agent, choose one of these installation methods:

Install the MySQL integration

Our MySQL integration monitors your databases and collects metrics about database utilization and connections, such as slowest queries and active connections by node.

To install the integration:

  1. Go to one.newrelic.com > Integrations & Agents.

  2. Search for and click MySQL.

  3. Select an account and follow the guided install steps.

    If you need to install the agent in a different way, see MySQL monitoring integration.

Install the Apache integration

Our Apache integrations collects network metrics like TCP connections, DNS lookup, HTTPS, SSL, and server and worker statuses.

To install the integration, follow the steps in our guided install.

If you need to install the integration in a different way, see Apache monitoring integration.

Install the Elasticsearch integration

Our Elasticsearch integration collects metrics like cluster status and current shards. If you're using Magento version 2.4 and higher, you'll need to install our Elasticsearch integration.

To install the integration:

  1. Go to one.newrelic.com > Integrations & Agents.

  2. Search for and click on Elasticsearch.

  3. Select an account and follow the guided install steps.

    If you need to install the integration in a different way, see Elasticsearch monitoring integration.

Set up synthetic monitoring

Our synthetic monitors test your app in different locations and capture server downtime. You can view this data in the Magento business insights dashboard.

To set up synthetic monitors, follow the steps in our guided install.

Create a Flex integration

Our custom Flex integration allows you to capture business metrics through queries of your app database.

To create your Flex integration:

  1. Create an nri-flex configuration file:

    • Path to the configuration file: /etc/newrelic-infra/integrations.d/
    • Configuration file name: mysql-database-config.yml
  2. Add the following code snippet to the configuration file. Be sure to change replace USERNAME, PASSWORD, AND DATABASE_NAME:

    # NOTE: 'database' is an experimental API at this time
    # ref: https://github.com/newrelic/nri-flex/blob/master/docs/experimental/db.md
    ---
    integrations:
    - name: nri-flex
    # interval: 30s
    config:
    name: MySQLDbFlex
    apis:
    - database: mysql
    # connection string for an rds mysql instance. Be sure to use the writer endpoint here.
    # /sys is the default database. newrelic:Password is the user:pass.
    db_conn: USERNAME:PASSWORD@tcp(localhost:3306)/DATABASE_NAME
    logging:
    open: true
    # custom_attributes: # applies to all queries
    # host: CustomMagentoMySQL # custom host name atribute
    db_async: true
    db_queries:
    - name: MYSQLSalesOrderDetails
    run: SELECT status AS 'status', entity_id AS 'order_id' FROM sales_order;
    - name: MySQLSalesOrderCumulative
    run: SELECT AVG(grand_total) AS 'average_grand_total', SUM(grand_total) AS 'grand_total_sum', SUM(total_item_count) AS 'total_order_item_count' FROM sales_order;
    - name: MySQLSalesOrderByStatus
    run: SELECT status AS 'order_status', COUNT(increment_id) AS 'total_orders', (SUM(grand_total)) AS 'total_billed_amount_by_status' FROM sales_order GROUP BY status;
    - name: MYSQLSalesOrderByCustomerGroup
    run: SELECT AVG(salesOrder.grand_total) AS 'grand_total_average_of_all_orders', customerGroup.customer_group_code AS 'customer_group_code' FROM `sales_order` salesOrder JOIN `customer_group` customerGroup ON salesOrder.customer_group_id = customerGroup.customer_group_id GROUP BY salesOrder.customer_group_id;
    - name: MYSQLSalesOrderByProduct
    run: SELECT items.order_id AS 'Order ID', items.created_at AS 'Order Created Date', orders.status AS 'Order Status', items.name AS 'productName', items.sku AS ProductSearchcode, orders.total_item_count AS 'Order Quantity', orders.grand_total AS 'Grand Total' FROM sales_order AS orders JOIN sales_order_item AS items ON items.order_id = orders.entity_id;
    - name: MYSQLSalesOrderByCategory
    run: SELECT items.name AS 'Category', AVG(orders.grand_total) AS 'average_order_total' FROM sales_order AS orders JOIN sales_order_item AS items ON items.order_id = orders.entity_id GROUP BY items.name;
    - name: MYSQLSalesOrderByRegion
    run: SELECT soa.country_id, soa.region_id, dcrn.name 'Region Name', so.entity_id AS 'Order ID', so.grand_total FROM sales_order_address soa JOIN directory_country_region_name dcrn JOIN sales_order so WHERE soa.region_id = dcrn.region_id AND so.entity_id = soa.parent_id;
    - name: MySQLSalesOrderPaymentCount
    run: SELECT count(*) as CountOfOrderByMethod, method as PaymentMethodType FROM `sales_order_payment` group by method;
    - name: MYSQLAbandonedCarts
    run: SELECT customer_email, items_count AS 'Products', items_qty AS 'Quantity', subtotal FROM `quote` WHERE customer_email IS NOT NULL AND reserved_order_id IS NULL AND subtotal != 0.0000;
    - name: MYSQLCustomerEntityRegisteredUsers
    run: SELECT count(*) AS 'Registered Accounts' FROM `customer_entity`;
    - name: MYSQLUnregisteredCustomers
    run: SELECT customer_email FROM sales_order WHERE customer_is_guest = 1 GROUP BY customer_email;
    - name: MYSQLSalesOrderByUnregisteredCustomersSummary
    run: SELECT COUNT(entity_id) AS 'Total Order Ids', SUM(grand_total) AS 'Grand Total Sum' FROM sales_order WHERE customer_is_guest = 1;
    - name: MYSQLCustomerEntityActiveUsers
    run: SELECT count(is_active) AS 'Active Users' FROM `customer_entity` WHERE is_active = 1;
    - name: MYSQLReturningCustomers
    run: WITH ctel1 AS (SELECT COUNT(entity_id) AS 'numberOfOrders', customer_email AS 'customerEmail' FROM sales_order GROUP BY customer_email) SELECT count(*) AS 'returningCustomers' FROM ctel1 WHERE numberOfOrders > 1;
    - name: MYSQLNewCustomers
    run: SELECT COUNT(DISTINCT email) AS 'newCustomers' FROM customer_entity WHERE MONTH(created_at) >= MONTH(CURRENT_DATE() - INTERVAL 1 MONTH);
    - name: MYSQLBestSellersDaily
    run: SELECT SUM(qty_ordered) as 'QuantityOrdered', product_name FROM sales_bestsellers_aggregated_daily GROUP BY product_id, product_name ORDER BY QuantityOrdered DESC;
    - name: MYSQLRevenuePerMonthAndYear
    run: SELECT SUM(grand_total) AS 'Total Revenue', AVG(grand_total) AS 'Average Revenue', YEAR(created_at) AS 'Year', MONTH(created_at) AS 'Month' FROM sales_order WHERE status = 'complete' GROUP BY YEAR(created_at), MONTH(created_at);
    - name: MYSQLMostViewedProductsDaily
    run: SELECT SUM(views_num) as 'View Count', product_name, product_id FROM report_viewed_product_aggregated_daily GROUP BY product_name, product_id ORDER BY View Count DESC;
    - name: MYSQLConversionRate
    run: WITH cte1 AS (SELECT soi.product_id AS 'SalesProductId', soi.name AS 'ProductName', COUNT(soi.order_id) AS 'Total Orders' FROM `sales_order_item` soi group by soi.product_id, soi.name), cte2 AS (SELECT viewed.product_id AS 'ProductID', COUNT(viewed.product_id) AS 'Total Views' FROM `report_viewed_product_index` viewed group by viewed.product_id) SELECT SalesProductId as 'ProductID', ProductName, Total Views, Total Orders, Total Orders / Total Views * 100 as 'Conversion Rate In Percent' FROM cte1 JOIN cte2 WHERE cte1.SalesProductId = cte2.ProductID;
    - name: MYSQLTopTenSalesOrdersByValue
    run: SELECT entity_id AS 'Order ID', total_item_count AS 'Order Quantity', created_at AS 'Created Date', grand_total AS 'Grand Total' FROM sales_order ORDER BY grand_total DESC LIMIT 10;
    - name: MYSQLOrdersAverage
    run: SELECT AVG(order_count) AS 'Average Number Of Orders', Year AS 'Year' FROM (SELECT YEAR(created_at) AS 'Year', COUNT(DISTINCT order_id) AS order_count FROM sales_order_item GROUP BY MONTH(created_at), YEAR(created_at)) subquery GROUP BY Year;
    - name: MYSQLWishlistProducts
    run: SELECT w.product_id, p.value AS 'Product Name', SUM(w.qty) AS 'Wishlist Count' FROM wishlist_item as w LEFT JOIN catalog_product_entity_varchar as p ON p.entity_id = w.product_id WHERE attribute_id = 73 GROUP BY w.product_id, p.value ORDER BY 'Wishlist Count' DESC;
    - name: MYSQLProductPageViewWithNoInventory
    run: SELECT v.product_id, v.product_name, v.views_num AS 'Page Views', i.qty AS 'Inventory Quantity' FROM report_viewed_product_aggregated_daily AS v LEFT JOIN cataloginventory_stock_item i ON i.product_id = v.product_id WHERE i.qty = 0 ORDER BY v.views_num DESC;
    - name: MYSQLHighestRestockAlerts
    run: SELECT p.value as Product Name, p.entity_id as Product ID, count(a.alert_stock_id) as Restock Alert Count FROM `product_alert_stock` AS a, `catalog_product_entity_varchar` as p where a.product_id = p.value_id GROUP BY p.value, product_id order by 2 desc;
    - name: MYSQLSlowMovingProducts
    run: SELECT cpev.entity_id as Product ID, cpev.value as Product Name, sum(isi.quantity) as Quantity from inventory_source_item as isi join catalog_product_entity as cpe on isi.sku = cpe.sku join catalog_product_entity_varchar as cpev on cpe.entity_id = cpev.entity_id where cpev.attribute_id = 73 group by Product ID, Product Name order by Quantity desc;
    - name: MYSQLAccountWithSmallTransaction
    run: SELECT sum(grand_total) as Grand Total, customer_email FROM sales_order group by customer_email order by Grand Total ASC LIMIT 10;
    - name: MYSQLProfitableCustomers
    run: select sum(grand_total) as Grand Total, customer_email from sales_order group by customer_email order by Grand Total desc LIMIT 10;
    - name: MYSQLRevenueLostDueToDiscounts
    run: SELECT SUM(base_discount_amount) as 'Due to Discounts Revenue Loss' FROM `sales_order` WHERE `status` = 'complete';
    - name: MYSQLTotalSalesCountDueToDiscounts
    run: SELECT count(base_discount_amount) as 'Due to Discounts Total Sales Count' FROM `sales_order` WHERE `status` = 'complete';
    - name: MYSQLProdCartAbandonment
    run: Select c.value as Product Name, sum(q.items_count) as Abandoned Products Count from quote as q join catalog_product_entity_varchar as c on q.entity_id = c.entity_id WHERE customer_email IS NOT NULL AND reserved_order_id IS NULL AND subtotal != 0.0000 AND attribute_id = 73 group by Product Name order by Abandoned Products Count;
    - name: MYSQLPaymentMethodChangedFrequently
    run: SELECT o.customer_id, o.customer_email, o.customer_is_guest, COUNT(DISTINCT p.method) AS transaction_count FROM sales_order AS o JOIN sales_order_payment AS p ON o.entity_id = p.parent_id GROUP BY o.customer_id, o.customer_email, o.customer_is_guest HAVING COUNT(DISTINCT p.method) > 1 ORDER BY transaction_count DESC LIMIT 10;
    - name: MYSQLCustomerAddressChanging
    run: SELECT c.entity_id AS customer_id, c.email, COUNT(DISTINCT a.entity_id) AS address_count FROM customer_address_entity AS a JOIN customer_entity AS c ON a.parent_id = c.entity_id GROUP BY c.entity_id, c.email HAVING COUNT(DISTINCT a.entity_id) > 1 ORDER BY address_count DESC;
    - name: MYSQLCustomerPurchaseSameProd
    run: select COUNT(soi.product_id) AS purchase_count, soi.product_id, soi.name as 'Product Name', so.customer_email from sales_order_item as soi join sales_order as so on soi.order_id = so.entity_id group by so.customer_email, soi.product_id, soi.name HAVING COUNT(soi.product_id) > 1 ORDER BY purchase_count DESC;
    - name: MYSQLProductReturned
    run: SELECT soi.product_id, count(soi.product_id) as 'Returned Product Count' FROM `sales_order` as o join `sales_order_item` as soi ON o.entity_id = soi.order_id where o.status = 'closed' and o.total_refunded is not null GROUP BY soi.product_id HAVING COUNT(soi.product_id) > 1;

Restart the infrastucture agent

Before you can start reading your data, use the instructions in our infrastructure agent docs to restart your infrastructure agent.

Install the Magento business insights dashboard

  1. Go to one.newrelic.com > Integrations & Agents > Dashboards.

  2. In the search bar, type "Magento business insights". The dashboard should appear.

  3. Click on it to install.

    Your Magento dashboard is considered a custom dashboard and can be found in the Dashboards UI. For information on using and editing dashboards, see our dashboard docs.

Query your Magento data

Interested in querying your Magento app data? Here's an example NRQL query checking the total registered customers on your Magento platform:

SELECT LATEST(`Registered Accounts`) AS 'Registered Accounts' FROM MYSQLCustomerEntityRegisteredUsers

What's next?

To learn more about querying your data and creating custom dashboards, check out these docs:

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.