# Dynamic content based on locale or IP Address

**URL:** <https://forum.builder.io/t/dynamic-content-based-on-locale-or-ip-address/14751>\
**Category:** Technical Questions\
**Created:** [May 9, 2025, 9:56pm UTC](https://forum.builder.io/t/dynamic-content-based-on-locale-or-ip-address/14751 "2025-05-09T21:56:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tyuWebstacks](https://avatars.discourse-cdn.com/v4/letter/t/53a042/32.png) [@tyuWebstacks](https://forum.builder.io/u/tyuWebstacks)\
**Post date:** [May 9, 2025, 9:56pm UTC](https://forum.builder.io/t/dynamic-content-based-on-locale-or-ip-address/14751/1 "2025-05-09T21:56:21Z")

</div>

- Is it possible to have dynamic content based on where the user is coming from? (Locale, known user IP address, etc.)
- ex: A page may say something about a specific country if their IP address is from that country while something different if their IP address is in the US

I know in Builder you have the ability to localize fields, whole entry, and data model. But is there anyway for say using a user’s IP address to show dynamic content. So if the user visits a page it will show dynamic content without using localized urls?

---

<div class="post-metadata">

**Author:** ![ParthSharma](https://avatars.discourse-cdn.com/v4/letter/p/a9adbd/32.png) [@ParthSharma](https://forum.builder.io/u/ParthSharma)\
**Post date:** [May 12, 2025, 10:25am UTC](https://forum.builder.io/t/dynamic-content-based-on-locale-or-ip-address/14751/2 "2025-05-12T10:25:00Z")

</div>

Hi Tracy​,

You can show dynamic content in [Builder.io](http://Builder.io) based on the user’s IP address (e.g., for geolocation or locale targeting) without requiring localized URLs. However, remember that this feature is part of the [Enterprise plan](https://www.builder.io/m/pricing).

Builder allows you to pass [custom user Attributes](https://www.builder.io/c/docs/custom-targeting-attributes)when fetching content, and these attributes can be used in targeting rules for content entries. For example, you can pass the user’s country code, region, city, etc., obtained from their IP address.

Step-by-Step Example:

1. Detect User’s Geolocation (e.g., server-side or with a geolocation API)

You can use a service like [IPinfo](https://ipinfo.io/), [ipapi](https://ipapi.co/), or any other to detect the user’s location server-side.

```auto
// Example: server-side (Next.js API route or middleware)
const geo = await fetch('https://ipapi.co/json').then(res => res.json());
const country = geo.country_name; // e.g., 'USA'

```

#### 2. **Pass** `userAttributes` **to Builder**

When calling `builder.get()` or `fetchOneEntry()`, pass `userAttributes` including `country`, `locale`, or any other relevant data:

```auto
builder
  .get('announcement-bar', {
    userAttributes: {
      urlPath: '/home',
      country: geo.country_name, // Example: 'USA'
      ip: geo.ip,
    },
  })
  .toPromise()
  .then(content => {
    // Render content with <BuilderComponent content={content} />
  });

```

#### 3. **Set Up Targeting in Builder UI**

Inside the Builder UI:

- Open your content entry (e.g., section, page).
- Click the **Targeting** icon (looks like a target).
- Set a condition like:

```auto
Where country equals "USA"

```

You can add multiple versions of the same content, each targeting different countries or regions.

Thank you,
