Add custom Javascript or CSS
If you want greater control you can add your custom javascript and code or file. Either globally or per page. There are 3 possibilities:
- Global code
- Custom HTML element
- Meta header
Global code
At the bottom right, there is a button named “code” that will give you access to global Javascript, CSS and HTML. There you can add any code that will apply to all pages.
Custom HTML element
This will allow you to add any HTML code you want. This also mean CSS <style>
tag or Javascript <script>
tag.
This code will also have access to the global variables defined in your design or font settings. Here is an example:
Meta header
Everything you add in the section for “META TAGS” (either globally or for a specific page) will be added in the header section.
This means that you can use this to add a <script>
or a <link>
tag to refer to external javascript and or css.
You could also use it to add inline script or css as well but, if you want to do this globally, use the first method above
Examples
Adding GTM
To add the Google Tag Manager correctly, you should add the javascript code provided
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXXX');</script>
<!-- End Google Tag Manager -->
in the global Meta tags (under “More” -> “SEO Settings”). Ref method 3 above
Secondly, add the iframe in the global code HTML - Ref first method above. It should look like:
{{content}}
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
The {{content}}
is important as it used to get the actual content of each page.