> ## 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).

# DNI: swap target formatting rules and common mistakes

The swap target is the phone number string you enter in Nimbata to tell the DNI script which number on your page to replace. 
If it doesn't match the number in your page's HTML exactly, the script finds nothing to replace and does nothing, the number on your site stays static.
This is one of the most common causes of numbers not swapping.

### How swap target matching works

1. When the Nimbata script loads, it scans the page's HTML for a text string that matches your swap target. 
2. The match is **exact and case-sensitive**. 
3. Any difference in spacing, punctuation, or format between your swap target and the number in your HTML will cause the match to fail.

### Formatting rules

**Enter the number exactly as it appears in your page source, not as it looks to visitors.**

Your website may display `(555) 123-4567` to visitors while the underlying HTML actually contains `555.123.4567`. 
The swap target must match the HTML source, not the rendered appearance.

Common format variations Nimbata can match (as long as your swap target matches one of them consistently):

* `555-123-4567`
* `(555) 123-4567`
* `555.123.4567`
* `+15551234567`
* `555 123 4567`

You only need to enter the number once. 
Nimbata normalizes most common separators when scanning.
The format in your swap target must still match the format in your HTML.

### Common mistakes

**1. Trailing or leading spaces**
If your HTML contains a space before or after the number (e.g. `555-123-4567`), the swap target must include it. 
Copy the number directly from your page source rather than typing it manually.

**2. Different format in the source vs. the swap target** 
Your page source might use `(555) 123-4567` but your swap target was entered as `555-123-4567`. 
These do not match. Inspect your page source (Ctrl+U in most browsers) and copy the number string exactly.

**3. Number rendered by JavaScript after page load** 
If the number is injected into the page by a page builder, CMS template, or third-party widget after the initial HTML is parsed, the swap target may match fine but the script runs before the number exists in the DOM. 
In this case, switch to the span tag method or enable **SPA mode** in [Tracking > Tracking Code](https://app.nimbata.com/tracking/tracking-code).

**4. Number inside an&#32;`<iframe>`** 
The Nimbata script runs in the context of your main page and cannot reach content inside an `<iframe>`. 
If your number is inside a widget, chat embed, or embedded form that uses an iframe, it cannot be swapped. 
The number must be placed directly in your main page HTML.

**5. Number split across HTML elements** 
If your number is broken across multiple HTML tags, e.g. `<span>555</span>-<span>123-4567</span>` , the script cannot match it as a single string. 
Place the full number inside a single element or use the span tag method.

### The reliable alternative: span tag

If you are seeing swap failures that are hard to diagnose, the span tag method avoids all format-matching issues entirely. 
Instead of scanning for a number, Nimbata replaces the contents of a specific `<span>` element by class name:

```
<span class="nimbata_number_1"></span>
```

The class name follows the pattern `nimbata_number_{swap_group_index}`. 
You can leave the span empty or place your regular number inside it as a fallback; Nimbata replaces whatever is there.
---

Detailed guide: [**How to set up span tag**](https://help.nimbata.com/en/article/how-to-set-up-span-tag-q57l1u/) 
Troubleshooting: [**DNI: troubleshooting checklist (numbers not swapping)**](#) 
Detailed guide: [**How to set up swap groups**](https://help.nimbata.com/en/article/how-to-set-up-swap-groups-1kng9t9/)
