Articles on: Call Tracking

How to set up the HTML element 'span tag' in Nimbata + add it to your website

Using Span Tags for number swapping


Span tags allow you to control exactly where Nimbata replaces phone numbers on your website. Instead of searching for phone numbers as plain text, Nimbata looks for specific <span> elements and replaces their contents with tracking numbers.


When should I use Span Tags?


Use span tags if:

  • Phone numbers are generated dynamically
  • Text-based number swapping does not work reliably
  • You want precise control over where numbers appear
  • You are using a CMS, templates, or JavaScript-rendered content


How Span Tag number swapping works


When 'Span Tag' is selected as the Swap Type:


  1. Nimbata’s tracking script scans the page after it loads
  2. It looks for <span> tags with a specific class name
  3. The contents of those <span> tags are replaced with the tracking number assigned to the corresponding swap group


The original phone number inside the span (if any) is ignored.


Required Span Tag format


To be detected by Nimbata, your span tags must follow this class format: {prefix}number{swap_group}


Prefix


  • nimbata for standard accounts
  • Your whitelabel name (lowercase) for whitelabel accounts


Swap Group


A number (1, 2, 3, etc.) that matches the swap group configured in Nimbata

E.g. <span class="nimbata_number_1"></span>


What gets replaced?


  • The entire contents of the <span> tag
  • Anything inside the span, such as text or placeholders


Both of the following work the same way:

  • <span class="nimbata_number_1"></span>
  • <span class="nimbata_number_1">555-555-5555</span>


How to set this up in Nimbata


Step 1. Go to Tracking > Tracking Code.

Step 2. Select 'Span Tag' as the Swap Type.



Step 3. Configure your Swap Groups and assign tracking numbers to each swap group.



Step 4. Click 'Save & Publish'.



Span Tag implementation example


Use the example below as a reference when adding span tags to your website. Place the <span> tag exactly where you want the tracking number to appear. Once the page loads, Nimbata automatically replaces the span with the correct tracking number based on the assigned swap group:


<p>

Call us at

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

for more information.

</p>


Aaaaand you're all set!

Updated on: 28/01/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!