I Have Custom Code, Where Do I Place It?

Custom code can be added to various parts of your website to accomplish certain things. When getting the code from another source, it's important to understand where that code must be placed.

If your code tells you to put one part in the header, look for the "header" instructions in this article to see how to paste it in the header.

Once you know where your code needs to be placed, you can follow this tutorial and the references below to figure out where and how to place your code on your site.

Site-Wide vs Individual Page

Depending on where you paste your code, you can paste it either site-wide (will appear on all pages) or on just one single page. The places that this tutorial instructs you to place code will let you know if it is a site-wide change or just a single individual page.

Placing Code via the HTML Widget

The HTML widget can be used to easily place code into your site. If you have any code that just needs to be placed on the site, simply follow the instructions below.

  1. Open the editor.
  2. In the left panel, click Widgets.
  3. Search for HTML.
  4. Drag the HTML widget anywhere into your site.
  5. Paste in your code.
  6. Done.

Site-Wide vs Single Page HTML Widget

Depending on where you place your HTML widget, it will either appear on all pages of your site or just a single page.

If you place the HTML widget in either the header or the footer, it will be placed on all pages of the site at the same time. This is because every site shares the header and footer.

If you place the HTML widget anywhere else, it will appear only in the body.

Place Code in the Header

Site-Wide Header

To place the code in the site-wide header, follow the instructions below.

  1. Open your editor.
  2. Go to Settings in the left panel.
  3. Click Header HTML.
  4. Paste in your code here and save.

Single Page Header

To place the code in the header of just one single page, follow the instructions below.

  1. In the side panel, click Pages.
  2. On the page, you want to add it into, click on the settings () icon.
  3. Click SEO.
  4. Scroll down to Header HTML.
  5. Paste in your code here and save.

Place Code After the Opening Body Tag

We currently do not have a feature to place code directly right after the opening body tag. However, you can paste code directly into the body-end.html file. There are two ways to do this, in developer mode or in settings.

To paste code directly into the body-end.html file in developer mode:

  1. Click the Developer Mode () icon at the top right.
  2. Click Site HTML / CSS to expand the selection.
  3. Click body-end.html.
  4. Paste your code into the last line here.
  5. Save and done.

To paste code directly into the body-end.html file in settings:

  1. Click Settings in the left panel.

  2. Click Head HTML.

  3. Paste your code into the Body End HTML field.

  4. Click Save.

Adding Tracking Code to a Contact Form

To add tracking code to a contact form, follow the instructions below.

  1. Navigate to the page your contact form is on.
  2. Left click your contact form to open the options.
  3. Click Submission.
  4. Click Tracking.
  5. Paste your conversion tracking code here.

Adding Code to a Widget

To add any code to any widget, follow the instructions below.

  1. Locate the page your widget is on.
  2. Right-click your widget to bring up the context menu.
  3. Click Edit HTML/CSS.
  4. Edit or add code here, as needed.

Notes, Considerations, and Troubleshooting

Always Create a Backup

It's recommended that you always create a backup of your site before adding custom code. This is because the custom code is difficult to troubleshoot and can potentially bring a website down if not done properly.

My code is disappearing when I place it in the head section

This is very common with pixel tracking codes. The head section (<head>) does not accept any code that is <img>, <iframe>, and more. It normally only takes <link>,<script> and <meta>.

If you have to paste in the code that's not being saved there, simply paste it in the header instead, where your navigation links and logos are.

Otherwise, paste it in the body-end.html as per the tutorial above.

My code is not working

If you have code that's not working on the site, it's most likely due to the code not being formatted correctly or not being HTTPS.

If you have any links in your code (http:// or //) and your site is using HTTPS or you're in the preview, then you will have to change that so that it's https:// instead. The reason for this is because the non-HTTPS code will not work in an HTTPS loaded connection (site preview, editor, etc).

Was this article helpful?
1 out of 1 found this helpful

Feedback on this article


Please sign in to leave a comment.


Please Log in as a Pro

Priority Phone Support is available exclusively to Pros. Log in to your Pro account now to see our international support numbers.

Log In
Not a Pro? Purchase a Pro plan!