Skip to main content
You can add custom JavaScript to any Beaver Builder layout, per-page or sitewide.
To override theme JavaScript, add the code to your theme settings or use the WordPress wp_enqueue_script() function.
The JavaScript tab does not support JavaScript code wrapped with <script>...</script> tags.

Per-page or per-post JavaScript

This procedure applies if you only want your JavaScript to apply to specific page or post using Beaver Builder. For example, suppose you have anchor points and wish to tweak the smooth scrolling effect for that page only. To do this:
1

Open Tools Menu

Open the Tools Menu from the Top Bar.
2

Open Layout CSS & JavaScript

Click Layout CSS & JavaScript.
3

Add JavaScript

On the JavaScript tab, enter your JavaScript code.
4

Save

Click Save.

Sitewide JavaScript

This procedure applies if you want your JavaScript to apply globally for all pages and posts which are using Beaver Builder. To do this:
1

Open Tools Menu

Open the Tools Menu from the Top Bar.
2

Open Global Settings

Click Global Settings.
3

Add JavaScript

On the JavaScript tab, enter your JavaScript code.
4

Save

Click Save.

Specific point in the page or post

You can add the JavaScript code to a specific point in your page or post using the HTML module.

Tracking scripts

It is not possible to add tracking scripts to Beaver Builder layouts, such as Google Analytics and Facebook pixels. Due to the fact that they need to be added to the <head> of your HTML page. In contrast, JavaScript added to either the Global Settings or Layout CSS & JavaScript is merged into the layout.js file, which loads in the footer of your website. If you’re using the BB Theme, you can add your tracking code using the theme’s code insertion options. For third-party themes, check to see if it has an option to add JavaScript to the <head> section. If not, you’ll need to use WordPress wp_head() function.

HTML

To add custom HTML to your Beaver Builder pages and posts you can use either the Text or HTML modules.

PHP

Beaver Builder doesn’t allow you to insert PHP code into post or page layouts. Instead, we recommend using the WordPress Shortcode API to create your own shortcode, then add it to a HTML module.

Build docs developers (and LLMs) love