> For the complete documentation index, see [llms.txt](https://docs.anedot.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.anedot.com/settings/page-presets/custom-code.md).

# Custom Code

Add header and body scripts to every Action Page in your Anedot account with Settings > Page Presets > Custom Code, after Anedot turns custom code on.

**Custom Code** adds your own script and style code to every public Action Page in your fundraising account. Use it for tracking or styling code that should run on all of your pages. You'll find it in **Settings > Page Presets > Custom Code**. This article covers who can use it, how to add your code, and how it runs on your pages.

{% hint style="info" %}
Custom code can be used by vendors and enterprise customers. **Page Presets** appears in the Settings menu only after Anedot turns on custom code for your account. To ask about it, contact our Support team at <help@anedot.com>.
{% endhint %}

## Before You Begin

* To add or change custom code, you need **Account Management: Edit Account Details and Configuration** permissions. See [Permission Sets](https://docs.anedot.com/settings/access/permission-sets.md).
* Your code applies to every Action Page in your account. To add tracking to one page, see [Page Settings: SEO, Sharing, and Tracking](https://docs.anedot.com/action-pages/page-builder/page-settings-seo-sharing-and-tracking.md).

{% hint style="warning" %}
A custom script can break your pages. You're responsible for any code you add. Anedot doesn't review, support, or debug custom scripts.
{% endhint %}

## Add Custom Code

To add custom code:

1. Go to **Settings > Page Presets > Custom Code**.
2. Paste your code into **Header Script**, **Body Script**, or both. Header Script code is added to the `<head>` tag of your Action Pages, and Body Script code is added to the `<body>` tag.
3. Click **Save**.

The message "Custom code saved." appears. To discard edits you haven't saved, click **Cancel**. To remove code, clear the field and click **Save**.

## How Custom Code Runs

* Only `<script>` and `<style>` tags are applied. Other tags, such as `<noscript>`, `<iframe>`, or `<img>` tracking pixels, are left out.
* Your code runs in the donor's browser after the page loads. It isn't part of the page's initial HTML.
* Your code doesn't run in the Page Builder preview. Open your live Action Page to check it.
* If the same code is in both fields, it runs only once.

## Troubleshooting

* **Your code isn't running:** Make sure it's inside a `<script>` or `<style>` tag, and test it on your live page instead of the preview.
* **Page Presets is missing from Settings:** Contact our Support team at <help@anedot.com>.
* **A script breaks your page and you can't remove it:** Contact our Support team at <help@anedot.com>.

## Related Articles

* [Page Presets](https://docs.anedot.com/settings/page-presets.md)
* [Page Settings: SEO, Sharing, and Tracking](https://docs.anedot.com/action-pages/page-builder/page-settings-seo-sharing-and-tracking.md)
* [Tracking Codes for Action Pages](https://docs.anedot.com/action-pages/advanced-features/tracking-codes-for-action-pages.md)
* [Settings](https://docs.anedot.com/settings.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.anedot.com/settings/page-presets/custom-code.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
