> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bsy.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Geo Targeting

> Enhance user engagement with Bitsy geo targeting, redirecting users based on their geographical location.

**What is Geo Targeting?**

Geo targeting is a feature that allows you to customize the user experience based on the geographical location of a visitor. By redirecting users to different URLs tailored to their specific countries — identified by their **ISO two-letter country codes** — you can provide more relevant and engaging content. This is essential for connecting with users in diverse markets and enhancing their experience.

**Optimize User Experience with Geo-Specific Redirects**

Bitsy's geo targeting feature enables seamless redirection of users to different URLs based on their location. This ensures that your content is relevant to their region, boosting engagement and satisfaction. Supported countries include a wide array of international locations.

### **How to Implement Bitsy Geo Targeting**

#### Step 1: Set Up Your Parameters

When configuring geo targeting, define specific parameters for each country. The key parameters include:

* **`long_url`**: The fallback URL for users who do not match any specified country.

* **`has_geo_targeting`**: Boolean indicating if geo-targeting is active.

* **`geo_targets`**: An array of geo-targeting rules, each containing:
  * **`country_id`**: Two-letter country code.
  * **`target_url`**: Specific URL for that country.

#### Step 2: Define Your Geo Targeting Logic

Here’s a straightforward logic structure for your targeting:

1. Check if the user's location matches any country in the `geo_targets` array.

   * If a match is found, redirect to the corresponding `target_url`.

2. If no matches are found, redirect to `long_url`.

#### Example Geo Targeting Configuration

Here’s a sample of how you might structure your geo targeting configuration:

```json theme={null}
{
  "long_url": "https://example.com/default",
  "has_geo_targeting": true,
  "geo_targets": [
    {
      "country_id": "US",
      "target_url": "https://example.com/us"
    },
    {
      "country_id": "CA",
      "target_url": "https://example.com/ca"
    },
    {
      "country_id": "GB",
      "target_url": "https://example.com/gb"
    }
  ]
}
```

#### Explanation of the Example

* **`long_url`**: This URL will be used as the fallback when no specific country targeting conditions are satisfied.
* **`has_geo_targeting`**: Indicates that geo-targeting is being utilized.
* **`geo_targets`**: An array of objects, each containing a `country_id` and its corresponding `target_url`.

#### Step 3: Testing Your Setup

Before going live, it’s crucial to test your configuration:

1. Use location spoofing tools or real devices to ensure users are redirected correctly based on their geographic location.

2. Verify that users from non-targeted countries are redirected to the `long_url`.

#### Conclusion

Implementing Bitsy geo targeting can significantly enhance user experience by providing relevant content tailored to each user's location. By establishing clear parameters and thoroughly testing your configuration, you can ensure optimal engagement with your audience.

<CardGroup cols={2}>
  <Card title="Try our API" icon="code" href="/api-reference/bitsy-link/create-link">
    Learn how to Implement Bitsy Geo Targeting
  </Card>
</CardGroup>

***
