IP Address for Contact Form

This works for me and I think that is a solution

Add a hidden field

Set up the Label “client-ip”

Insert following Code in Custom JS Editor

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. :roll_eyes:

2 Likes