This plugin lets you add JS scripts from the admin panel. You can add scripts to the header or the footer of your website.
For example, add Google Analytics, Facebook Pixel, or any other tracking script.
composer require monsieurbiz/sylius-scripts-plugin
Create the config file in config/packages/monsieurbiz_sylius_scripts_plugin.yaml
:
imports:
resource: '@MonsieurBizSyliusScriptsPlugin/Resources/config/config.yaml'
Go to the admin panel, then Settings
> Scripts
and add your scripts:
And that's it! Your scripts will be added:
Open the config/packages/monsieurbiz_sylius_scripts_plugin.yaml
file and change the default values. For example:
monsieurbiz_sylius_settings:
plugins:
monsieurbiz_scripts.scripts:
default_values:
before_head_end: |
<script type="text/javascript">console.log('My script');</script>