> 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/action-pages/advanced-features/tracking-codes-for-action-pages.md).

# Tracking Codes for Action Pages

Add Google Analytics (GA4), Tag Manager, Meta Pixel, X Pixel, and UTM tracking codes to your Action Pages.

Configure **Google Analytics&#x20;*****(GA4)***, **Google Tag Manager&#x20;*****(GTM)***, **Meta Pixel** *(including Conversions API)*, **X Pixel** *(formerly Twitter)*, and **UTM parameters** on your Anedot Action Pages to track supporter behavior, monitor conversions, and improve campaign attribution.

*Tracking Codes can be applied to **Donation**, **Lead**, and **Event Pages**.*

To apply Tracking Codes to a **Donation** or **Lead Page**, access the **Settings** tab within the Page Builder (tracking codes appear under **Tracking codes** on that panel).

To apply Tracking Codes to an **Event Page,** access the **Settings → Analytics** tab within the Event Page Builder.

## Google Analytics *(GA4)*

Setting up **Google Analytics 4&#x20;*****(GA4)*** on your Anedot Action Page tracks how visitors engage with your page, where they come from, and when they complete a submission.

### Tracked Events

| Event      | Trigger                                  | Data Sent        | Description                              |
| ---------- | ---------------------------------------- | ---------------- | ---------------------------------------- |
| page\_view | Page load                                | Default GA4 data | Captures every visit to your Action Page |
| purchase   | Form submission (with eCommerce enabled) | value, currency  | Captures a completed donation            |

**Tips & best practices**

* Use **GA4 + GTM together** for more robust tracking *(browser + custom tags)*.
* Use **UTM parameters** on Action Page links for campaign attribution.
* The `Purchase` event is only sent when **eCommerce is enabled**.
* If you use a **Callback URL** instead of the default Anedot receipt page, the GA4 `purchase` event won't trigger - use GTM to fire it via a dataLayer push or a Page View trigger on your callback page.
* Anedot automatically pushes donation value to the **dataLayer** for custom GA4 or ad tracking setups.

### Setup Steps

**1. Log in to Google Analytics** and create or access a GA4 Property.

**2. Copy the Measurement ID** from `Admin -> Data Streams -> Web -> Measurement ID`.

**3. Add Measurement ID to Anedot** - go to Donation + Lead Page Builder: **Settings** (Tracking codes), or Event Page Builder: **Settings -> Analytics**; paste the ID; click **Publish**.

**4. Enable eCommerce&#x20;*****(Optional)*** - check `\"Send eCommerce events to Google\"` to send a GA4 `purchase` event.

## Google Tag Manager *(GTM)*

Setting up **Google Tag Manager&#x20;*****(GTM)*** on your Anedot Action Page lets you manage and deploy marketing and analytics tags without modifying code, including tags that fire on confirmation events.

### Setup Steps

**1. Log in to GTM** at [tagmanager.google.com](https://tagmanager.google.com).

**2. Copy the Container ID** from **Google Tag Manager Dashboard -> Workspace** *(top-right; e.g., `GTM-XXXXXXX`)*.

**3. Add to Anedot** - go to Donation + Lead Page Builder: **Settings** (Tracking codes), or Event Page Builder: **Settings -> Analytics**; paste the **Container ID**; click **Publish**.

**4. Configure Triggers in GTM**

1. **Page View Trigger** *(for `/receipt`)* - used for most ad platforms *(like Google Ads)*:
   1. **Triggers -> New** -> **Trigger Configuration** -> **DOM Ready**
   2. Fire on **Some DOM Ready Events** where `Page Path` -> `equals` -> `/receipt`
   3. Name *(e.g., Receipt DOM Ready)* and **Save**
2. **Custom Event Trigger** *(Ecommerce)* - when GA4 eCommerce is not enabled in Anedot:
   1. **Triggers -> New** -> **Trigger Configuration** -> **Custom Event**
   2. Event Name: `google_analytics_ecommerce_transaction`
   3. Name *(e.g., GA Ecommerce Event)* and **Save**

**5. Configure Tags in GTM**

1. **Google Ads Conversion Tag** - tracks successful submissions:
   1. **Tags -> New** -> **Tag Configuration** -> **Google Ads Conversion Tracking**
   2. Enter **Conversion ID** and **Conversion Label**
   3. *(Optional)* Set **Conversion Value** to a constant or a variable from `.ap-confirmation--total-amount` / `dataLayer`
   4. Assign a Trigger and **Save**
2. **GA4 Event Tag** *(Optional - only if GA4 is not enabled in Anedot)*

If GA4 is already enabled in Anedot and "Send eCommerce events to Google" is checked, this tag may duplicate tracking. Use only if GA4 is not enabled via Anedot.

1. **Tags -> New** -> **Tag Configuration** -> **GA4 Event**
2. Enter **GA4 Measurement ID**; Event Name: `purchase`
3. Add Event Parameters: `value` (donation amount variable), `currency` (`\"USD\"` or applicable)
4. Assign a Trigger and **Save**

**6. Access Donation Value**

* **Option 1**: Scrape from DOM using `.ap-confirmation--total-amount` on the receipt page.
* **Option 2**: Use the `dataLayer` - Anedot pushes donation value there for GTM variables or JavaScript.

***Tips:***

* Use **GTM and GA4 together** for robust browser + server tracking.
* If using a **Callback URL**, standard tags tied to `/receipt` may **not fire**. Trigger your Page View tag on the **Callback URL path** instead, and add your **GA4 Measurement ID** directly in Anedot so ecommerce tracking still fires reliably.

## UTM Parameters for Campaign Tracking

**UTM parameters** are custom tags added to the end of your URL to help you identify the origin, method, and purpose of incoming traffic to your Action Pages. They are critical for **campaign attribution** and **audience insights** - especially when using **Google Analytics 4 (GA4)** and **Google Tag Manager (GTM)**.

**Why and when to use UTM parameters**

UTM parameters help you attribute donations to campaigns or ads, see which platforms drive traffic, A/B test variants, view campaign performance in GA4, and drive GTM logic *(e.g., fire a tag only for a specific campaign)*.

Add UTM-tagged URLs whenever you share an Action Page link - paid ads, email, SMS, social posts, partner links, or QR codes.

### Setup Steps

1. Use a tool like **UTMMaker.com** to create URLs, then add them to Action Page links.
2. Example: `https://secure.anedot.com/account-url-slug/page-slug?utm_source=facebook&utm_medium=paid&utm_campaign=year_end_appeal`

**Supported Parameters**

| Parameter     | Description                                  |
| ------------- | -------------------------------------------- |
| utm\_source   | Traffic source (e.g., facebook)              |
| utm\_medium   | Channel (e.g., email, social, cpc)           |
| utm\_campaign | Campaign name (e.g., fall\_fundraiser)       |
| utm\_content  | Ad/test variant (e.g., button\_a, image\_b)  |
| utm\_term     | Search term (used in paid keyword campaigns) |

### View Campaign Data

UTM data is **automatically picked up by GA4** *(Acquisition reports: `source`, `medium`, `campaign`)* and available in **GTM's dataLayer**. No Anedot setup is required - parameters are captured from the URL when a supporter loads the page.

## Meta *(Facebook)* Pixel

Setting up a **Meta Pixel** on your Anedot Action Page tracks supporter interactions and conversions across Facebook and Instagram - helping you measure results and build custom or retargeting audiences in Meta Ads Manager.

**Anedot Tracking Options**

Anedot provides three Meta tracking options:

| Option                 | What it does                                           | When to use it                                                  |
| ---------------------- | ------------------------------------------------------ | --------------------------------------------------------------- |
| Meta Pixel ID          | Browser tracking for PageView, Lead, and Purchase.     | Basic ad reporting and remarketing.                             |
| Meta Access Token      | Conversions API (CAPI) server-side events from Anedot. | Recommended for reliable attribution (see Meta best practices). |
| Hide Client-Side Pixel | Disables browser pixel; CAPI only.                     | Advanced privacy or custom attribution setups.                  |

> ***Note:** Both **Pixel ID** and **Access Token** are required in Anedot to enable Conversions API.*

**Best practice: use Pixel ID + Access Token together**

Meta recommends both **browser** and **server-side** tracking for reliability, attribution, deduplication, and ad optimization. Only enable **Hide Client-Side Pixel** for server-side-only, strict privacy/consent, or custom attribution needs.

***Tip:** For most users, leave the browser pixel active and use Pixel ID + Access Token together.*

### Tracked Events

| Meta Event | Trigger           | Extra Data      |
| ---------- | ----------------- | --------------- |
| PageView   | Page load         | -               |
| Lead       | Form submitted    | -               |
| Purchase   | Donation complete | currency, value |

***Tip:** Use a **Custom Domain** for better attribution accuracy (available from Anedot on request).*

### Setup Steps

1. **Retrieve Meta Pixel ID and Access Token** from Meta Events Manager
   1. Go to [https://eventsmanager.facebook.com](https://eventsmanager.facebook.com/) and log in with your Meta Business account. *(Requires Admin access to Meta Business Manager)*
   2. Select your **Business Account**.
   3. In the left sidebar, click **Data Sources** -> **Pixels**.
   4. Copy the **Pixel ID** listed under the Pixel name *(15-16 digit number)*.
   5. *(Optional)* **Generate Access Token** for Meta Conversions API:
      1. Go to **Events Manager** -> **Data Sources** -> **Pixels** -> **Settings**.
      2. Click **Generate Access Token**.
      3. **Copy the token** and store it securely *(Meta only shows it once)*.
2. **Add to Anedot**
   1. Go to Donation + Lead Page Builder: **Settings** (Tracking codes), or Event Page Builder: **Settings -> Analytics**.
   2. Paste your **Pixel ID**.
   3. *(Optional)* Paste the **Access Token**.
   4. Click **Publish**.

## X (Twitter) Pixel

Adding the **X Pixel** to your Anedot Action Page tracks key conversion events - like donations or signups - so you can attribute results to your X *(formerly Twitter)* Ads, build retargeting audiences, and optimize campaign performance.

### Tracked Events

| Event Name | Trigger                  | Data Sent       | Description                                        |
| ---------- | ------------------------ | --------------- | -------------------------------------------------- |
| PageView   | On page load             | None            | Tracks page views for retargeting and reach.       |
| Purchase   | On successful submission | value, currency | Captures a completed donation with monetary value. |

> **Notes:**
>
> * The `Purchase` event only fires when the **default Anedot receipt page** is shown.
> * If using a **Callback URL**, this event will **not trigger automatically** - use GTM to fire `Purchase` on the callback page *(see **Trigger the X Pixel Purchase Event with GTM** below)*. On the default receipt page, `value` is taken from `.ap-confirmation--total-amount`; with a Callback URL, pass the donation value via GTM *(URL parameters or dataLayer)*.
> * These events support **conversion tracking**, **audience optimization**, and **campaign reporting** in X Ads.

### Setup Steps

1. Log in to [ads.twitter.com](https://ads.twitter.com/) with your X *(Twitter)* account.
2. In the top navigation, select **Tools** -> **Events Manager**.
3. Under **Pixels**, find your Pixel and copy the **Pixel ID** *(numeric string)*.
4. In Anedot, go to Donation + Lead Page Builder: **Settings** (Tracking codes), or Event Page Builder: **Settings -> Analytics**.
5. Paste the **Pixel ID** and click **Publish**.

### Trigger The X Pixel Purchase Event with GTM

If your Action Page redirects to a custom receipt page *(Callback URL)*, X Pixel's `Purchase` event won't fire automatically. Use GTM to trigger it on your thank-you page:

1. Log in at [tagmanager.google.com](https://tagmanager.google.com).
2. **Create the Trigger:** **Triggers -> New** -> name it *(e.g., `Callback Page Purchase`)* -> **Trigger Configuration** -> **Page View** -> **Some Page Views** where `Page Path` -> `equals` -> `/thank-you` *(or your callback path)* -> **Save**.
3. **Create the Custom HTML Tag:** **Tags -> New** -> name it *(e.g., `X Pixel - Purchase`)* -> **Tag Configuration** -> **Custom HTML** -> paste:

```html
<script>
  twq('event', 'Purchase', {
    value: ,  /* set donation value via GTM variable */
    currency: 'USD'
  });
</script>
```

4. Under **Triggering**, select the trigger from step 2, then **Save**.
5. **Submit** and **Publish** your container.

## Related

* [Page Settings: SEO, Sharing, and Tracking](/action-pages/page-builder/page-settings-seo-sharing-and-tracking.md)
* [Page Builder Overview](/action-pages/page-builder.md)
* [Custom Domain & Email Branding](/settings/configuration/custom-domain-and-email-branding.md)
* [URL Parameters](/action-pages/advanced-features/url-parameter.md)
* [Advanced Features](/action-pages/advanced-features.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/action-pages/advanced-features/tracking-codes-for-action-pages.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.
