# IP Address for Contact Form

**URL:** <https://community.elfsight.com/t/ip-address-for-contact-form/36769>\
**Category:** Contact Form\
**Tags:** Gathering-Feedback\
**Created:** [January 10, 2024, 2:30pm UTC](https://community.elfsight.com/t/ip-address-for-contact-form/36769 "2024-01-10T14:30:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shaan](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@Shaan](https://community.elfsight.com/u/Shaan)\
**Post date:** [January 10, 2024, 2:30pm UTC](https://community.elfsight.com/t/ip-address-for-contact-form/36769/1 "2024-01-10T14:30:10Z")

</div>

Can you include the IP address of the sender of the contact form to help identify if the inquiry is legitimate or not?

---

<div class="post-metadata">

**Author:** ![Max](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/max/32/710_2.png) [@Max](https://community.elfsight.com/u/Max)\
**Post date:** [January 10, 2024, 4:31pm UTC](https://community.elfsight.com/t/ip-address-for-contact-form/36769/2 "2024-01-10T16:31:40Z")

</div>

Hi there @Shaan 👋

I see your point, but I’m not sure that we’ll be able to release such a complex use case, I’m afraid. Anyway, if this request gets more votes, we’ll try to consider this option in our future updates.

Many thanks for sharing your idea and welcome to the Community 😉

---

<div class="post-metadata">

**Author:** ![Dung\_Tran](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/dung_tran/32/8664_2.png) [@Dung\_Tran](https://community.elfsight.com/u/Dung_Tran)\
**Post date:** [October 27, 2024, 9:16am UTC](https://community.elfsight.com/t/ip-address-for-contact-form/36769/3 "2024-10-27T09:16:19Z")

</div>

Please release this feature. This is necessary for me. I got spammed

---

<div class="post-metadata">

**Author:** ![Max](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/max/32/710_2.png) [@Max](https://community.elfsight.com/u/Max)\
**Post date:** [October 28, 2024, 12:34pm UTC](https://community.elfsight.com/t/ip-address-for-contact-form/36769/4 "2024-10-28T12:34:54Z")

</div>

Hi there, @Dung_Tran 👋

Thanks for sharing your feedback with us!

If more users support this idea, it might be considered in the future 🙂

As for now, you can enable reCAPTCHA as a spam protection step from bots. You can find this setting in the Spam Protection section on the Settings tabs:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/elfsight/original/3X/4/9/4954620bc50aa090ed934322903c99c6162d0c75.png) ![image](https://us1.discourse-cdn.com/flex020/uploads/elfsight/original/3X/e/2/e2f550f9bd2d3487f91af1e297087d071f11e95a.png)

---

<div class="post-metadata">

**Author:** ![Sina](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/sina/32/59970_2.png) [@Sina](https://community.elfsight.com/u/Sina)\
**Post date:** [November 24, 2024, 5:40pm UTC](https://community.elfsight.com/t/ip-address-for-contact-form/36769/5 "2024-11-24T17:40:40Z")

</div>

This works for me and I think that is a solution

> **Add a hidden field**
>
> ![grafik](https://us1.discourse-cdn.com/flex020/uploads/elfsight/original/3X/1/a/1a5a6c8a7207d36327688ee69811005a8065adb2.png)
> 
> Set up the Label “client-ip”
> 
> ![grafik](https://us1.discourse-cdn.com/flex020/uploads/elfsight/original/3X/d/2/d24040fcead4da2faa4aad27eae626987bf62945.png)

> **Insert following Code in Custom JS Editor**
>
> ![grafik](https://us1.discourse-cdn.com/flex020/uploads/elfsight/original/3X/9/1/916e9b05d61d810bc7c253d712f76b91115e4cdd.png)
> 
> ```auto
> async function setClientIP() {
> try {
> // Get the client's public IP address
> const response = await fetch('https://api.ipify.org?format=json');
> const data = await response.json();
> 
> // Insert IP address into the variable
> const clientIP = data.ip;
> 
> // Put the IP address in the widget field
> widget.setFieldValue('[client-ip]', `IP: ${clientIP}`);
> } catch (error) {
> console.error('Error getting IP address:', error);
> }
> }
> 
> // call Funktion
> setClientIP();
> 
> ```

> **Add Field ID in Email Form**
>
> Insert **[client-id]** in the Emailtext or as already known use **[form-data]**

> GDPR compliance must be observed and data economy must be applied.

@Max @Helga @Rena If that’s allowed, then I’ll take a like and solution mark. 🙄

---

<div class="post-metadata">

**Author:** ![Helga](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/helga/32/1155_2.png) [@Helga](https://community.elfsight.com/u/Helga)\
**Post date:** [November 25, 2024, 11:54am UTC](https://community.elfsight.com/t/ip-address-for-contact-form/36769/6 "2024-11-25T11:54:54Z")

</div>

@Sina thanks a lot for sharing your solution! It’s definitely a working solution, though there are a couple of important nuances:

- Without a propper test, we now cannot evaluate how good the service you’re using in your JS code is, but it’s definitely working.

- Since this code collects user data (IP addresses), questions of legitimacy arise. You’ll need to inform your clients that their IP addresses will be collected.

- Lastly, all responsibility for applying this customization lies with our clients 🙏🏻

---

<div class="post-metadata">

**Author:** ![Sina](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/sina/32/59970_2.png) [@Sina](https://community.elfsight.com/u/Sina)\
**Post date:** [November 25, 2024, 4:48pm UTC](https://community.elfsight.com/t/ip-address-for-contact-form/36769/7 "2024-11-25T16:48:35Z")

</div>

Hi @Helga  
shure. GDPR compliance must be observed and data economy must be applied.

regards sina
