> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hiveku.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add a Tracking Code to Every Page

> Paste a tracking or chat snippet once and have it added to every page of your site, or to one page only

Many services ask you to paste a snippet of code into your website: an advertising pixel, a heat-map tool, a chat widget. In Hiveku you paste it once on the **Custom Code** page and it's added to every page when you deploy.

This guide pastes a made-up example snippet into Northwind's Pearl District site, then removes it.

## Open Custom Code

Open the website, click its name at the top of the page, then **Hosting**. At the top right of the Hosting page, click **Custom Code**.

Pick the environment at the top: **Production** is your live site. Each environment keeps its own code (Preview, Development, Production, and Staging if you use it), so you can try a snippet on Development first.

## Paste the snippet

The service that gave you the snippet says where it goes:

* **Head code** is added at the end of the page's head. Most tracking codes go here.
* **Footer code** is added just before the end of the page. Some chat widgets ask for this spot.

Northwind pasted its example into **Head code**. The counter at the right shows how much of the 20,000 characters it uses.

![Custom Code: Add code to the head and body of every page, changes save per environment and take effect on the next deploy of that environment. Preview, Development and Production tabs with Production picked; under Site-wide code, Head code holds an example snippet, outlined: a comment and a script tag loading tag.example.com/tag.js?id=NW-12345](https://mintcdn.com/locusdigital/lZcuweQKlHSSXswv/images/how-tos/websites/cc-01-head-closeup.webp?fit=max\&auto=format\&n=lZcuweQKlHSSXswv\&q=85\&s=b90d0a36187c1a78e95f6d89e67345af)

> [!NOTE]
>
> Use the snippet exactly as the service gave it to you. Northwind's points at `example.com`, so it does nothing.

## Add code to one page only

Some codes belong on a single page, such as a conversion tag on a thank-you page. Under **Per-page code**, type the page's address (for example `/thank-you`) and click **Add page**, then paste the code for that page. It's added after the site-wide code, on that page only.

## Save, then deploy

Click **Save Production** at the bottom of the page.

![Per-page code, with a box showing /pricing as an example address and Add page; Advanced, base URL and link prefix, which most sites leave empty; and Save Production, outlined](https://mintcdn.com/locusdigital/lZcuweQKlHSSXswv/images/how-tos/websites/cc-02-save-closeup.webp?fit=max\&auto=format\&n=lZcuweQKlHSSXswv\&q=85\&s=65b50542b9ec6fde3edfbd95075f48a9)

A note confirms it.

![Saved. Changes take effect the next time you deploy this environment. Go to Hosting](https://mintcdn.com/locusdigital/lZcuweQKlHSSXswv/images/how-tos/websites/cc-03-saved-closeup.webp?fit=max\&auto=format\&n=lZcuweQKlHSSXswv\&q=85\&s=285489112603b142ddd3e17d5310780a)

The code reaches your live site the next time you deploy. Click **Deploy** at the top right and deploy to Production, as in [Publish Your Changes](/how-tos/site-builder/publish).

Northwind's Pearl District site isn't published, so it emptied **Head code** and saved again after this guide.

## Good to know

* **To remove a snippet**, delete it from the box, save, and deploy.
* **Leave Advanced alone** unless your site is served from a folder of another site. Most sites leave it empty.
* **Tags that social sites read** when someone shares your link go in the SEO settings instead. [Improve How a Page Shows in Google](/how-tos/site-builder/page-titles-for-google) shows the SEO tab.
* **Google Analytics** has its own guide: [Add Google Analytics](/how-tos/add-google-analytics).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.