mixpanel / mixpanel-python

Official Mixpanel Python library.
https://mixpanel.com/help/reference/python
Other
103 stars 85 forks source link

Document Proxy method for frontend events #75

Closed dawsbot closed 5 years ago

dawsbot commented 5 years ago

An official document from Mixpanel Support recommends a backend proxy to avoid ad-blockers. This involves setting the api_host when initializing the frontend JS library. But I cannot seem to find anywhere that says how the backend should be configured to proxy.

Here is the help article, method number four here is what I'm speaking about: https://help.mixpanel.com/hc/en-us/articles/115004499463-Ad-Blockers-Affect-Mixpanel

Our backend is a flask-python application, and we already have a BE integration of Mixpanel for server-side events.


Self-Research

dawsbot commented 5 years ago

Hi @zakj @smcoll @joeymalysz (most-recent contributors)

Do you know how I can get attention to this better from the mixpanel team? Thanks

dawsbot commented 5 years ago

I've sent in an official support email to @mixpanel now. Will respond here with examples if we can get them 🙌

seizethedave commented 5 years ago

Hi @dawsbot, I have been doing a little research on how to answer your question. Proxying the Mixpanel API isn't something that's super well documented - partly because of how custom it'd need to be from customer to customer. The most simplistic solution would be to write Flask URL handlers for /track and /engage that take the given query string and base64-encoded payload and constructs another request to https://api.mixpanel.com/track or /engage. You'd need to include the X-Forwarded-For header so our IP-based geolocation continues to work properly.

David

P.S. if you are an nginx user, you should talk to support about a new program we're trying out.

dawsbot commented 5 years ago

Aha, so no documentation will come on this? I guess that's because there's not a standard payload that could be proxied through for a given event?

Re-open this if you think others could benefit from seeing this

odusseys commented 3 years ago

This would be nice to have - we want to proxy but it's far from straightforward & a simple tutorial would save us a lot of time debugging.