Of course! For the users already ingested, you can use our API Update Multiple Profiles to set the Geolocation properties:
$region
$city
$country_code
Hi Judy, so sorry - not sure why the message didn't sync 🤔 Thanks for following up! Diving right in, I understand what you mean. When you delete the IP property entirely from your events or profiles in Rudderstack, Mixpanel still receives the request with an IP address - specifically, the IP address of the server making the API call (in your case, likely Rudderstack's servers probably based in Ashburn, Virginia). Mixpanel then uses this server IP to determine geolocation. Setting the IP value to "0" is different from deleting it because it explicitly tells Mixpanel to ignore IP-based geolocation. As per our docs, etting $ip or ip to "0" is the way to prevent Mixpanel from updating geolocation data as mentioned in my mail previously.
Hi Judy 👋 Thanks for reaching out to Mixpanel Support. I'm Abhilash, and I'd be glad to look into this with you! So sorry for the inconvenience! 🙇 By default, geolocation properties are set using the IP address of the location in where the request was made. If you’re tracking from your server, you need to override the IP property of your events and profile updates from your server’s IP address to the client’s IP address.
For event data, the geolocation event properties are derived from the IP address of the client device or server that sent the event track/import request. (e.g. calling .track())
For profile data, the geolocation profile properties are derived from the IP address of the client device or server that sent the profile update request. (e.g. calling .people.set())
In this case, you will want to either ignore the IP address or set the geolocation manually. To ignore the IP addresses: To prevent the Engage API from updating your profile geolocation using the IP address of the incoming request, you can set the $ip to 0 in your payload.
// $ip set to 0
// Engage API will ignore not parse the IP address
// Geolocation will not be updated
{
"$token": "mytoken",
"$distinct_id": "13793",
"$ip": "0",
"$set": {
"My_property": "my_value"
}
}
You can set append ip=0 to your request URL to set $ip to 0 for all your Engage requests.
api.mixpanel.com/engage?verbose=1&ip=0
You can also manually define the IP address value of your payloads, and Mixpanel will parse for the geolocation using your IP address value instead of the IP address of the request location. The IP address is dropped prior to ingestion, so if you are looking to track the IP address as a property inside Mixpanel, name the property something else. Note that:
ip is used for event payloads
$ip is used for profile payloads
If you’re tracking from your servers, you need to set the ip property of the events to the client’s IP address. Most server frameworks provide this out of the box. So, for profiles:
// set location of the profile to 136.24.0.114
// note that $ip is outside of the $set object
{
"$token": "mytoken",
"$distinct_id": "13793",
"$ip": "136.24.0.114", // example IP
"$set": {
"My_property": "my_value"
}
}
I'm afraid Mixpanel doesn't currently support backfilling the correct location for your users based on the client-side events. However, you can manually update the user profiles with the correct location information if you have it. You can read more about the topic here: Mixpanel's Geolocation Best Practices. Does that help? Please let me know if you have further questions or need anything else! 🙌