I'm using Rudderstack with Mixpanel. Even though I'm deleting the IPs on all server-side events in a transformation, Mixpanel is setting all profiles to Ashburn, Virginia (the server location), despite there being client-side events with the correct location (in Australia). How can I stop it doing this? In addition - is there any way to backfill the correct location for my users based on the client side events?
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! 🙌
In terms of manually updating the profiles - is there a batch edit tool that would allow this?
Hi, I replied in the Slack thread - is there a reason this doesn't sync through? Thank you! CheersJudyTo unsubscribe from this group and stop receiving emails from it, send an email to .
Received via email
Email text may have been truncated. Please review in Zendesk ticket.
To clarify - the response from Support outlines how to handle this issue via Mixpanel's own eventing, but as flagged in my initial question, we use Rudderstack, a CDP, so the above doesn't really answer my questiob. We were deleting the IPs on the Rudderstack side, but this didn't appear to do anything; we're now trying this with setting it to 0. However, I'm not sure why it wouldn't work by deleting them. Can I see what event is filling in the IPs? All the events I can see in any given user's activity log all appear to have the right geolocation
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.
Great, thanks so much - I've changed the way the transformation works to set the value explicitly to 0. Is it possible to batch update existing user profiles, if I have the correct location data for them?
Of course! For the users already ingested, you can use our API Update Multiple Profiles to set the Geolocation properties:
$region
$city
$country_code