These guidelines apply to [apps in the Shopify admin](/docs/apps/build/app-surfaces#embedded-app-pages) only. ## Improve your app's loading performance Loading performance is an important part of the user experience when using apps in the Shopify admin. When your app is slow to load, it dissuades users from adopting it, increases bounce rates, and decreases overall usage. You can also improve your app's loading experience by minimizing visual noise, such as layout shifts, and clearly indicating loading progress. As a result, users will perceive your app as faster and more responsive, even if the loading time doesn't change. Refer to the [Polaris best practices for loading](https://polaris.shopify.com/foundations/patterns/loading) for a complete guide on designing a high-quality experience. ### Measure your app's loading performance Shopify uses Web Vitals to measure your app's performance in the Shopify admin. Each time a user loads your app, we gather and save the Web Vitals metrics in order to better understand the user experience. To learn more about Web Vitals, you can refer to the introduction on [web.dev](https://web.dev/vitals/) ![Diagram showing sequence of Web Vitals metrics on an app in the Shopify admin.](/assets/apps/best-practices/performance/webvitalsdiagram.png) > Note: >

To enable Shopify to gather Web Vitals metrics, you might need to update to the latest version of App Bridge by adding the App Bridge script to your app's head. The App Bridge script can exist alongside App Bridge installed as a packaged dependency and does not require a full migration.

Updating your app to a version that supports admin performance tracking is a prerequisite to reaching Built for Shopify status.

Shopify's Web Vitals package measures your app's performance each time a merchant launches your app through any route. Although Shopify doesn't modify scores provided by Web Vitals, there are some differences in how they're recorded in embedded apps compared to standard web development: - Embedded apps run in iFrames, so tools like [Lighthouse](/docs/storefronts/themes/tools/lighthouse-ci) might not accurately capture performance. - To normalize collecting metrics across different application stacks, Shopify records Web Vitals events in a separate runtime from your application. To help you use performance data and ensure your app is performing optimally, Shopify provides the following key features: - The ability to monitor Web Vitals in real-time - Tools for debugging The following sections describe how you can use these features to enhance your app's performance. #### Monitor Web Vitals The Web Vitals API allows you to access performance metrics directly in your app, giving you real-time insights into your app's performance. You can implement it using the following code: ```html ``` The callback is called with Web Vitals data, allowing you to send it to your own server for analysis. By monitoring these metrics, you can identify performance issues as they occur and make necessary optimizations. #### Debugging Web Vitals While monitoring provides ongoing insights, sometimes you need to dig deeper to understand specific performance issues. To help with this, Shopify provides a debugging tool for Web Vitals. To enable detailed logging of Web Vitals as they're recorded and saved, add the `shopify-debug` meta flag to your application's head: ```html