Skip to main content
All CollectionsOutboundBuild your experience
Custom code in head and body tags
Custom code in head and body tags

Add custom code and scripts that apply to your landing pages.

Updated over a week ago

If you have an Enterprise Workspace, you can add custom code and scripts that apply to your individual landing pages. This can be useful for adding additional HTML, CSS, and JavaScript.

You can also use the code embed element to add custom blocks of HTML code to your site design or rich text elements.

Supported code

The custom code sections in Organisation and Page settings only support HTML, CSS, and JS. You can’t integrate server-side languages (such as Perl, PHP, Python, or Ruby) in any code section.

💡 Need to know
The Head code and Footer code sections in Organisation settings can accommodate up to 50,000 characters each, and custom code in the <head> tag and before the </body> tag in Page settings can accommodate up to 50,000 characters each. If the code you want to add to your site is longer, you can store it on another server and reference the script in your custom code. You can also minify your custom code using a third-party tool.

Tags

ℹ️ Important

If your custom code has opening and/or closing tags, make sure to add those to ensure your code works as expected. Additionally, don’t include <html>, <body>, or <head> tags in your custom code, or your website/layout will break.

Link tag: <link>

The <link> tag defines a link between a document and an external resource and should always go in the <head> code section.

Meta tag: <meta>

The <meta> tag provides metadata about your site and should always go in the <head> code section.

Style tags: <style></style>

The <style></style> tags define additional CSS styles in your site and should always go in the <head> code section.

Script tags: <script></script>

The <script></script> tags allow you to embed JavaScript in your site and can be added to either the <head> code section or before the closing </body> tag (i.e., the Footer code section). However, adding your <script></script> tags just before the closing </body> tag ensures your site pages load all their content before the JavaScript is processed, which helps with page load speed and provides a better user experience.

Custom code in Organisation settings

Head code

Custom code entered in the Head code section appears before the closing </head> tag in your site’s HTML markup and applies to all your generated pages. The Head code section allows you to link external resources, add metadata, and use custom styles.

💡 Good to know

Adding external <script> tags to the <head> of your page can slow page loads. Consider adding the async or defer attribute in the <script> tag to improve performance.

To add custom code to the Head tag:

  1. Visit organisation Settings > Custom code tab

  2. Add your custom code in the Head code section

  3. Click Save changes

Footer code

Code entered in the Footer code section appears before the closing </body> tag in your site’s HTML markup and applies to all your generated landing pages.

To add custom code to the Head tag:

  1. Visit your organisation Settings > Custom code tab

  2. Add your custom code in the Footer code section

  3. Click Save changes

ℹ️ Important

Custom scripts will only appear on the published page.

Custom code in Page settings

The code included in the custom code section of any template will only apply to the pages generated from that template, and will appear after any organisation-wide custom code in your site’s HTML markup.

In the <head> tag

<link>, <meta>, and <style></style> tags should always go inside the <head> tag. <script></script> tags can also be added inside the <head> tag, but adding scripts before the closing </body> tag typically improves site performance and provides a better experience for your site visitors.

💡 Good to know

Adding external <script> tags to the <head> of your site can slow page loads. Consider adding the async or defer attribute in the <script> tag to improve performance.

To add custom code inside the <head> tag of an individual template:

  1. Open your template in the editor

  2. Open Template settings for the template where you’d like to add your code

  3. Add your custom code to the Inside <head> tag section under Custom code

  4. Save your changes

Before the </body> tag

Generally, <script></script> tags should go in this section.

To add custom code before the closing </body> tag of an individual template:

  1. Open your template in the editor

  2. Open Template settings for the template where you’d like to add your code

  3. Add your custom code to the Before </body> tag section under Custom code

  4. Save your changes

ℹ️ Important

Custom scripts will only appear on the published site.

FAQ and troubleshooting tips

Can I use server-side languages in my organisation or template-level custom code?

You can’t integrate server-side languages (e.g., Perl, PHP, Python, Ruby) using custom code. Custom code in organisation and template settings only supports HTML, CSS in <style> tags, and JS in <script> tags.

Can I increase the character limit for custom code?

The Head code and Footer code sections in Organisation settings can accommodate up to 50,000 characters each, and custom code in the <head> tag and before the </body> tag in Template settings can accommodate up to 50,000 characters each. If the code you want to add to your site is longer, you can store it on another server and reference the script in your custom code. You can also minify your custom code using a third-party tool.

Why isn’t my custom code taking effect in preview mode?

Custom scripts will only appear on the published site.

Did this answer your question?