Add Custom Java Script inside Magento Static Blocks
Magento is a competent eCommerce CMS for designing a creative and multifunctional online store that can handle a lot of customers at a time. Apart from being a powerful and flexible content management system, it offers a popular tool in web development, the Java Script programming language.
Store managers can add custom Java scripts to Magento web pages. You can add the code inside a static block and include them in multiple pages, if you wish to use the same code throughout your website. This tutorial will help you how to add custom Java script in hosted scripts and code snippets.
How to Add Custom Java script in Hosted Scripts and Code Snippets
- Log in to your Magento store backend after entering the correct credentials
- From the Admin Panel, go to CMS > Static Blocks
- Next, click Add New Block button. Fill up all the required fields
- In the Content field, click Show / Hide Editor button. Paste the custom java script in the code snippet.
- Create a new frontend app from CMS > Frontend Apps
- Select the type as CMS Static Block. Then click Continue to proceed.
- In the Frontend App Instance Title, define a title for the block
- Click Add Layout Update in the Layout Updates panel
- Select the pages to which the static block is to be applied in Display On section
- Select Page Footer in the Block Reference field
- Next, click the Frontend App Options from the left menu. From this panel, specify the static block you wish to include.
- Click the Save button to save the changes made
This is the most recommended way to add custom Java scripts in Magento. But if you are unable to include them correctly, then follow the above steps once again or Request a Quote with us.