bricks_analyze_performance
Overview
Analyzes a Bricks page for performance metrics including element count, nesting depth, inline CSS size, font count, external scripts, and DOM complexity. Returns metrics alongside optimization suggestions.
This is the dedicated performance analysis tool that provides deeper insights than the general « performance » check in bricks_analyze_page. It measures specific performance indicators that affect page load time and rendering speed.
Use this when you suspect a page is slow or overly complex, or as part of the Phase 5 polish workflow to optimize before publishing.
Key Features
When to Use
You want to check if a page has too many elements or excessive nesting depth
You need to audit how many fonts, external scripts, or inline styles are on a page
You are optimizing pages before launch for Core Web Vitals
You want specific performance metrics rather than general quality findings
Bricks Builder version 1.9 or higher
When NOT to Use
You want a general quality audit — use bricks_analyze_page with all checks
You want to check real-world page speed — use external tools like Lighthouse or PageSpeed Insights
Parameters
Warning: Undefined array key "param_enum_values" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 28
page_idnumberREQUIREDCode Examples
Warning: Undefined array key "example_output" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 12
Check page performance
Analyzes performance metrics for the homepage.
bricks_check_performance({
page_id: 33
})
// Returns:
// {
// metrics: {
// element_count: 85,
// max_nesting_depth: 7,
// inline_css_size: 12400,
// font_count: 2,
// font_weight_count: 4,
// external_script_count: 3,
// dom_complexity_score: 42
// },
// rating: "moderate",
// suggestions: [
// { message: "Consider extracting 12 inline styles to global classes", priority: "high" },
// { message: "Reduce font weights from 4 to 2-3 for faster loading", priority: "medium" }
// ]
// }Common Mistakes
Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 1935
Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48
Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 1935
Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48
Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Tips & Warnings
Tip: Target these thresholds for optimal performance: element count under 80, nesting depth under 8, inline CSS under 30KB, font count under 3, external scripts under 5.
Tip: The biggest performance win is usually extracting inline styles to global classes. If inline CSS is high, run bricks_audit_site with the duplicate_styles check to find consolidation opportunities.
Warning: DOM complexity is a proxy metric. The actual performance impact depends on the browser, device, and total page weight including images, fonts, and third-party scripts.