File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 9393 */
9494@property (atomic ) NSUInteger flushInterval;
9595
96+ /* !
97+ @property
98+
99+ @abstract
100+ Controls whether to automatically send the client IP Address as part of
101+ event tracking. With an IP address, geo-location is possible down to neighborhoods
102+ within a city, although the Mixpanel Dashboard will just show you city level location
103+ specificity. For privacy reasons, you may be in a situation where you need to forego
104+ effectively having access to such granular location information via the IP Address.
105+
106+ @discussion
107+ Defaults to YES.
108+ */
109+ @property (atomic ) BOOL useIPAddressForGeoLocation;
110+
96111/* !
97112 @property
98113
Original file line number Diff line number Diff line change @@ -86,6 +86,14 @@ -(Mixpanel*) getInstance: (NSString *)name {
8686 resolve (nil );
8787}
8888
89+ // disable ip address geolocalization
90+ RCT_EXPORT_METHOD (disableIpAddressGeolocalization:(NSString *)apiToken
91+ resolve:(RCTPromiseResolveBlock)resolve
92+ reject:(RCTPromiseRejectBlock)reject) {
93+ [self getInstance: apiToken].useIPAddressForGeoLocation = NO ;
94+ resolve (nil );
95+ }
96+
8997// track with properties
9098RCT_EXPORT_METHOD (trackWithProperties:(NSString *)event
9199 properties:(NSDictionary *)properties
Original file line number Diff line number Diff line change @@ -71,6 +71,11 @@ export class MixpanelInstance {
7171 return RNMixpanel . flush ( this . apiToken )
7272 }
7373
74+ disableIpAddressGeolocalization ( ) : Promise < void > {
75+ if ( ! this . initialized ) throw new Error ( uninitializedError ( 'disableIpAddressGeolocalization' ) )
76+ return RNMixpanel . disableIpAddressGeolocalization ( this . apiToken )
77+ }
78+
7479 alias ( alias : string ) : Promise < void > {
7580 if ( ! this . initialized ) throw new Error ( uninitializedError ( 'createAlias' ) )
7681
@@ -241,6 +246,12 @@ export default {
241246 defaultInstance . flush ( )
242247 } ,
243248
249+ disableIpAddressGeolocalization ( ) {
250+ if ( ! defaultInstance ) throw new Error ( NO_INSTANCE_ERROR )
251+
252+ defaultInstance . disableIpAddressGeolocalization ( )
253+ } ,
254+
244255 createAlias ( alias : string ) {
245256 if ( ! defaultInstance ) throw new Error ( NO_INSTANCE_ERROR )
246257
You can’t perform that action at this time.
0 commit comments