First I want to say thank you for creating this library; it saved me a lot of time!
Referring to Mixpanel's geolocation and user profile updates, ip=(1|0) flag should be in the URL query string, not inside property field in the request payload. The latter should be filled with the actual IP address.
My use case is to include geolocation data (e.g. city and country) in each event, not just user profile. I've tried to call below method with ip: '1' but the location data don't appear in Mixpanel event. So I tried sending events with Mixpanel Java API with useIpAddress flag set to true, and in that case the location data is shown in Mixpanel. It turned out that the ip parameter is appended to the end of the query string.
Snippet from src/mixpanel_analytics.dart:
Future<bool> track({
@required String event,
@required Map<String, dynamic> properties,
DateTime time,
String ip,
String insertId,
}) async {
if (event == null) {
throw ArgumentError.notNull('event');
}
if (properties == null) {
throw ArgumentError.notNull('properties');
}
var trackEvent = _createTrackEvent(
event, properties, time ?? DateTime.now(), ip, insertId);
if (isBatchMode) {
_trackEvents.add(trackEvent);
return _saveQueuedEventsToLocalStorage();
}
var base64Event = _base64Encoder(trackEvent);
return _sendTrackEvent(base64Event);
}
I think the above code misinterpreted the documentation:
Could it be modified so that ip flag is placed as a query parameter? e.g.:
Hi,
First I want to say thank you for creating this library; it saved me a lot of time!
Referring to Mixpanel's geolocation and user profile updates,
ip=(1|0)
flag should be in the URL query string, not insideproperty
field in the request payload. The latter should be filled with the actual IP address.My use case is to include geolocation data (e.g. city and country) in each event, not just user profile. I've tried to call below method with
ip: '1'
but the location data don't appear in Mixpanel event. So I tried sending events with Mixpanel Java API withuseIpAddress
flag set totrue
, and in that case the location data is shown in Mixpanel. It turned out that theip
parameter is appended to the end of the query string.Snippet from
src/mixpanel_analytics.dart
:I think the above code misinterpreted the documentation:
Could it be modified so that
ip
flag is placed as a query parameter? e.g.: