# Adding custom code

> Add a chat widget, a review badge or another service's code to your photography website: site-wide snippets, code for one page, and the Embed element.

Source: https://help.corehue.co/docs/websites/adding-custom-code/

Services like live chat, review badges and newsletter sign-ups usually give you a few lines of code to paste into your website. Where you paste it depends on whether it belongs on every page, on one page, or in a particular spot on a page.

> **Available on Pro**
Custom code, page code and the Embed element are included on the Pro plan. See [CoreHue plans](/docs/plans-and-billing/corehue-plans).

| You want to add | Use |
| --- | --- |
| Something on every page, or several pages, like a chat widget or a site verification tag | **Custom code** in **Settings → Integrations** |
| Something on one page only, like a conversion tag on your thank-you page | The **Code** section of that page's settings |
| Something visitors can see, placed where you want it, like another service's booking calendar or a map | The **Embed** element |

Google Analytics, Meta Pixel, Pinterest Tag and Google Tag Manager don't need code. You paste their IDs instead. See [Adding analytics and a cookie banner](/docs/websites/analytics-and-cookie-banner).

## Adding code to your whole site

1. In the website editor, go to **Settings → Integrations → Custom code**.
2. Choose **Add code**.
3. Give it a **Name** you'll recognize later, like "Live chat".
4. Paste the service's code into **Code**.
5. Under **Where it runs**, set the **Placement**, **Runs** and **Pages**.
6. Choose **Add code**, then publish your website.

| Setting | Choices |
| --- | --- |
| **Placement** | **Head** for code the service says belongs in the head of your page, such as verification tags. **End of page** for most widgets, and the safer pick if the instructions don't say. |
| **Runs** | **Always**, **After analytics consent** or **After marketing consent**. The consent choices only matter while your cookie banner is on. |
| **Pages** | **Every page**, or **Chosen pages** and tick the ones you want. |

Each snippet has its own switch, so you can turn one off without deleting it. Open a snippet to change it or choose **Delete code**. You can keep up to 20. If you paste something meant to show on the page, the box tells you, and it belongs in an Embed element instead.

## Adding code to one page

1. In the **Pages** tab, open the page's menu and choose **Settings**.
2. Scroll to **Code**.
3. Paste into **Head** or **End of page**, whichever the service asks for.
4. Pick when it **Runs**, then publish.

Page code saves as soon as you click out of the box, so there's no need to choose **Save** for it. Below Pro, the **Code** section shows what's there but stays locked.

## Placing an embed on a page

1. Open the page and add an **Embed** element to a section.
2. Paste the service's code into **Embed code**.
3. Give it a **Title** that says what it is, like "Availability calendar".
4. Set **Height** to **Fit content** so it grows with what's inside, or **Fixed** to choose a height yourself.
5. Pick when it **Runs**, then publish.

An embed stays in its own box, so it can't affect the rest of your page. Inside the box, widgets work as they would on any website, even ones that need to remember a visitor. While one loads, the box keeps its space and the widget fades in, so the page doesn't jump around. If a service's code needs to work across the whole page, use custom code instead.

## Code and the cookie banner

While your cookie banner is on, code set to wait for consent only runs once a visitor allows that category. An embed that's waiting shows a short note in its place, such as "Availability calendar uses marketing cookies.", with a button to allow it.

While the banner is off, all your code runs straight away, and the **Runs** box reminds you of that. Chat widgets and ad tags usually count as marketing, and visitor counters as analytics.

## Before you add code

Code snippets only run on your published website, never in the editor or in Preview, so publish and check your live site in a private window. **Discard changes** puts code back to what's live, like your other settings.

We can't support code from other services, so if a widget misbehaves, ask the service that made it. Every script also slows your pages a little, so remove anything you no longer use.

## Frequently asked questions

### What happens to my code if I leave Pro?

It stays in your settings, where you can read and delete it, but it isn't added to your published site. Embeds only show in your editor. Upgrade again and it all works as before.

### Can I use custom code to change my website's design?

You can add styles, but the **Design** tab is the better route. It changes the whole site at once and won't break when you change theme.

### Where do I put a Google Search Console verification tag?

Add it as custom code with **Placement** set to **Head**, **Runs** set to **Always** and **Pages** set to **Every page**, then publish. If your website is on your own domain, you can verify with a DNS record instead, which works on Plus too. See [Getting your website found on Google](/docs/websites/getting-found-on-google).

### Why isn't my widget showing?

Check that its switch is on, that you published afterwards, and that your cookie banner isn't holding it back until you accept. Then open your live site in a private window.
