> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.nimbata.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How to set up server-side tracking with Nimbata (sGTM)

|| This guide assumes you already have a Google Tag Manager Server container (sGTM) provisioned and running. If you haven't set that up yet, follow Google's official sGTM setup guide before continuing.

Server-side tracking sends Nimbata call events directly from a secure server to Google Analytics 4, bypassing ad-blockers and browser privacy restrictions that would otherwise intercept or drop the data. This guide walks through the full configuration in both Nimbata and Google Tag Manager.

# 1. Configure Nimbata

### Step 1. Open the Google Analytics integration

* Go to [Integrations](https://app.nimbata.com/integrations/service/google-analytics) in the left-hand menu.
* Under **Tracking Method**, select **Server-side (sGTM)**.

![](https://storage.crisp.chat/users/helpdesk/website/-/2/f/4/5/2f459a49cf382400/image_tre4d4.png)

### Step 2. Enter your sGTM Server URL

* In Google Tag Manager, go to **Admin > Container Settings**.
* Copy the **Server container URL**.
* Paste it into the **sGTM Server URL** field in Nimbata.

![](https://storage.crisp.chat/users/helpdesk/website/-/2/f/4/5/2f459a49cf382400/image_1xufmex.png)

![](https://storage.crisp.chat/users/helpdesk/website/-/2/f/4/5/2f459a49cf382400/image_6dc96e.png)

### Step 3. Enter your Measurement ID

* In Google Analytics 4, go to **Admin > Data Streams** and select your stream.
* Copy the **Measurement ID** (format: `G-XXXXXXXXXX`).
* Paste it into the **Measurement ID** field in Nimbata.

| Leave the **sGTM Activation Path** field empty for now. You will fill it in after completing Step 5.

# 2. Create the GA4 Measurement Protocol client in sGTM

This client is the entry point for Nimbata's server-side requests into your sGTM container.

### Step 4. Create a new client

* In Google Tag Manager, go to **Clients** and click **New**.
* Set the client type to **Measurement Protocol (GA4)**.

### Step 5. Set the Activation Path

* Add an **Activation Path** (for example: `/nimbata`).
* Copy the value.
* Paste it into the **sGTM Activation Path** field in Nimbata.

![](https://storage.crisp.chat/users/helpdesk/website/-/2/f/4/5/2f459a49cf382400/image_120oprs.png)

### Your Nimbata setup should now look like this:


![](https://storage.crisp.chat/users/helpdesk/website/-/2/f/4/5/2f459a49cf382400/image_mqnpqj.png)

||| The Activation Path must match exactly between Nimbata and your GTM client, including any leading slash.

# 3. Create the fpid transformation

This transformation adds a first-party client ID to incoming events, ensuring accurate user stitching across sessions.

### Step 6. Add a new transformation

* In your sGTM container, go to **Transformations** and click **New**.
* Configure it as follows:

| Field | Value |
| ---- |
| Transformation Name | `fpid_transformation` |
| Transformation Type | Augment event |
| Name | `first_party_id` |
| Value | `{{v - Incoming Client ID}}` |
| Matching condition | `{{Client Name}}` equals `GA4 MP` |

![](https://storage.crisp.chat/users/helpdesk/website/-/2/f/4/5/2f459a49cf382400/image_roscft.png)

| Use whatever name you gave your client in Step 4 as the matching condition value.

# 4. Create a custom variable template

Before creating your variables, you need a custom template to cleanly extract the real visitor IP from the X-Forwarded-For header.

### Step 7. Create the template

* In Google Tag Manager, go to **Templates** and click **New Variable Template**.
* Name it: `Clean X-Forwarded-For`.
* Add a field named `headerValue`.
* Paste the following into the code editor:

```
const headerValue = data.headerValue;

if (!headerValue) {
  return undefined;
}

let raw = headerValue.trim();
if (!raw) {
  return undefined;
}

let first = raw.split(',')[0];
if (!first) {
  return undefined;
}

first = first.trim();

if (first.charAt(0) === '[') {
  const closingBracket = first.indexOf(']');
  if (closingBracket > 0) {
    first = first.substring(1, closingBracket);
  }
} else {
  const colonCount = first.split(':').length - 1;
  if (colonCount === 1 && first.indexOf('.') > -1) {
    first = first.split(':')[0].trim();
  }
}

first = first.trim();

return first || undefined;
```

* Save the template.

# 5. Create four user-defined variables

Create these variables in the order listed. Variables 3 and 4 depend on the template from the previous step.

### Step 8. v - Incoming Client ID

* Go to **Variables** and click **New** under User-Defined Variables.
* Configure as follows:

| Field | Value |
| ---- |
| Variable Type | Event Data |
| Key path | `client_id` |

![](https://storage.crisp.chat/users/helpdesk/website/-/2/f/4/5/2f459a49cf382400/image_itdwm2.png)

### Step 9. h - User-Agent

* Click **New** and configure as follows:

| Field | Value |
| ---- |
| Variable Type | Request Header |
| Name | `User-Agent` |

![](https://storage.crisp.chat/users/helpdesk/website/-/2/f/4/5/2f459a49cf382400/image_lupy8l.png)

### Step 10. clean - ip_override from xff

* Click **New** and configure as follows:

| Field | Value |
| ---- |
| Variable Type | Clean X-Forwarded-For |
| headerValue | `{{h - X-Forwarded-For}}` |

![](https://storage.crisp.chat/users/helpdesk/website/-/2/f/4/5/2f459a49cf382400/image_u9wjnw.png)

### Step 11. h - X-Forwarded-For

* Click **New** and configure as follows:

| Field | Value |
| ---- |
| Variable Type | Request Header |
| Name | `X-Forwarded-For` |

![](https://storage.crisp.chat/users/helpdesk/website/-/2/f/4/5/2f459a49cf382400/image_1cn0xw8.png)

# 6. Update your GA4 tag

### Step 12. Add parameters and apply the transformation

* In your sGTM container, open your existing **GA4 tag**.
* Under **Parameters**, add the following:

| Parameter Name | Value |
| ---- |
| `ip_override` | `{{clean - ip_override from xff}}` |
| `user_agent` | `{{h - User-Agent}}` |

* Under **Transformations**, apply **fpid_transformation**.

![](https://storage.crisp.chat/users/helpdesk/website/-/2/f/4/5/2f459a49cf382400/image_bfhkb0.png)

# 7. Configure the Conversion Linker tag

### Step 13. Edit or create the Conversion Linker tag

* Open or create the **Conversion Linker** tag in your sGTM container.
* Set the trigger to fire on all events (or all pages, depending on your setup).
* Save and **publish** your container.

![](https://storage.crisp.chat/users/helpdesk/website/-/2/f/4/5/2f459a49cf382400/image_se4ifg.png)

---

🎉 Nimbata will now send call events directly to your sGTM container. Each event is enriched with first-party ID and device data, then forwarded to GA4, bypassing ad-blockers and browser restrictions entirely. Make a test call to confirm the event appears in your GA4 real-time view.

Detailed Guide: [**Tracking numbers 101: how to set up call tracking numbers with Nimbata**](https://help.nimbata.com/en/article/tracking-numbers-101-how-to-set-up-call-tracking-numbers-with-nimbata-1ww2fxu/) 
Detailed Guide: [**How to connect Nimbata to Google Analytics 4**](https://app.nimbata.com/integrations/service/google-analytics)
