> For the complete documentation index, see [llms.txt](https://docs.realmacsoftware.com/elements-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.realmacsoftware.com/elements-docs/site-quality/analytics.md).

# Analytics

Add analytics and tracking code to your website

If you’d like to track traffic or integrate services like Google Analytics or Google Tag Manager, you’ll need to add their code snippets to your project. Where you add the code depends on whether you want it to apply to all pages or just one.

{% hint style="success" %}

### **Recommended Analytics Service (GDPR Compliant)**

We recommend [Fathom Analytics](https://usefathom.com/ref/81P61Z), which is easier to understand and use than Google Analytics. **Fathom is GDPR compliant and doesn’t require cookie notices**.
{% endhint %}

{% embed url="<https://www.youtube.com/watch?v=sfzIONiv2zY&feature=youtu.be>" %}

### Add Tracking to Every Page

To include your tracking code on every page of your site:

1. Open the Site Settings window.
2. Select the Template section.
3. Paste your code into either:
   * Between the `<head>` tags for anything that belongs in the \<head>, such as Google Analytics or similar.
   * After the opening `<body>` tag for content such as Google Tag Manager’s \<noscript> block.

This ensures your tracking code is included automatically across every page.

<figure><img src="https://3876014504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNy6AECEVH2p4eFDicpM1%2Fuploads%2Fe00ncLAXLEd6ctlDvnWn%2FCleanShot%202025-07-02%20at%2012%E2%80%AF.33.37%402x.png?alt=media&amp;token=5547fec2-f268-4c20-baa7-b6cff5150ad6" alt="Site template editor with analytics code added before the closing body tag"><figcaption><p>Adding site-wide code to the Template area.</p></figcaption></figure>

### Add Tracking to an Individual Page

If you only want to add tracking code to a specific page:

1. Select the page in the sidebar.
2. Click the Edit Extra Code button in the Page Inspector.
3. Choose the correct code area from the list on the left (e.g. Head Start, Body Start).
4. Paste your code snippet in the appropriate section.

The code will only be included on that specific page when you publish or preview your site.

<figure><img src="https://3876014504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNy6AECEVH2p4eFDicpM1%2Fuploads%2Fk5hzKss2pBEMohNK4hCP%2FCleanShot%202025-07-02%20at%2012%E2%80%AF.40.12%402x.png?alt=media&amp;token=e330597e-07f8-437a-b896-9a5f25104c15" alt="Page code editor with the page-specific Body End section selected"><figcaption><p>Adding code to a specific page.</p></figcaption></figure>


---

# 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.realmacsoftware.com/elements-docs/site-quality/analytics.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.
