Search code examples
pythonmixpanel

Excluding default IP in Mixpanel track event (Python SDK)


I am sending some events to mixpanel from within a cloud function, using the Python SDK. I don't want the users' location to be set to the location of the cloud server. I have read the Mixpanel article referencing this, but the documentation only shows how to ignore IP for a people_set call, using the meta argument. I assumed the same logic would translate to the track call, as it also has the meta argument in its documentation.

After testing, the people_set call is not taking the server location, but the track call is still taking the server location. Does anyone have any ideas why this might be, or how to correctly go about this task for a track() call? Below are the code snippets for the two calls:

mp_eu.people_set(user_id, user_data,
                 meta={'$ignore_time': True, '$ip': 0})

mp_eu.track(user_id, 'event_name', event_data,
            meta={'$ignore_time': True, '$ip': 0})

Solution

  • You should add "ip" to "properties".

    properties["ip"] = ip
    mp_eu.track(user_id, 'event_name', properties)
    

    check this. https://help.mixpanel.com/hc/en-us/articles/115004499343