Align v1.7 is out now! Learn more about the best release yet →
The Custom JavaScript block allows users to insert custom JavaScript code into their theme, enhancing its functionality with embedded forms, services, or other scripts. This block is available in the "Custom code" and "Code viewer" sections, offering flexibility in script application.
Users can input JavaScript code directly into the block without <script>
tags, ensuring proper execution within the theme. This feature is ideal for integrating third-party services or adding custom functionalities not natively supported by the theme.
Practical uses of the Custom JavaScript block include embedding third-party forms, adding analytics tracking scripts, and enhancing user interaction with dynamic elements like sliders or pop-ups. By leveraging this block, users can tailor their theme to meet specific needs and preferences.
Overview #
The Custom JavaScript block is designed to allow users to insert custom JavaScript code into their theme. This functionality is particularly useful for adding embedded forms, services, or any other custom scripts that enhance the functionality of the theme. The block is available in the "Custom code" and "Code viewer" sections, providing flexibility in how and where the custom scripts are applied.
Key components and functionality #
Custom JavaScript
This block enables the insertion of custom JavaScript into your theme. It is ideal for users who need to integrate third-party services or add custom functionality that is not natively supported by the theme.
-
Code: This setting allows you to input your JavaScript code directly. The code should be inserted without the
<script>
tags, as the block will handle the necessary wrapping. This ensures that the JavaScript is executed correctly within the theme.
Available in sections #
- Custom code
- Code viewer
Usage examples #
-
Embedding a Third-Party Form: If you need to add a form from a third-party service, you can use the Custom JavaScript block to insert the necessary JavaScript code. Simply copy the code provided by the service and paste it into the "Code" setting of the block.
-
Adding Analytics Tracking: For users who want to add custom analytics tracking scripts, the Custom JavaScript block provides a straightforward way to include these scripts without modifying the theme's core files.
-
Enhancing User Interaction: Use the block to add interactive elements such as sliders or pop-ups that require JavaScript to function. This can improve the user experience by making the site more dynamic and engaging.
By utilizing the Custom JavaScript block, users can significantly extend the capabilities of their theme, tailoring it to meet specific needs and preferences.
Align v1.7 is out now! Learn more about the best release yet →