GithubHelp home page GithubHelp logo

Comments (5)

jaredmixpanel avatar jaredmixpanel commented on September 18, 2024

@ttmdung203 The SDK does not send geolocation info. When useIPAddressForGeoLocation is true the server will use the IP address to add geo info to the event after it is received. Make sure you're not manually setting a city property anywhere in your code. For further assistance please reach out to [email protected]

from mixpanel-swift.

ttmdung203 avatar ttmdung203 commented on September 18, 2024

I set useIPAddressForGeoLocation = false immediately as you see at below code, there's no manual city parameters for sure.

mixpanelInstance = Mixpanel.initialize(token: token, trackAutomaticEvents: true)
mixpanelInstance.delegate = self
mixpanelInstance.useIPAddressForGeoLocation = false

It happens randomly, I was looking into source code and found that there is a chance of flushing events immediately right after Mixpanel.initialize, before I set delegate and useIPAddressForGeoLocation. (Version: 4.2.0)

init(apiToken: String?, flushInterval: Double, name: String, trackAutomaticEvents: Bool, optOutTrackingByDefault: Bool = false,
         useUniqueDistinctId: Bool = false, superProperties: Properties? = nil,
         serverURL: String? = nil) {
....
....
 flushInstance.flushInterval = flushInterval
}
Screenshot 2024-03-12 at 10 44 39 AM Screenshot 2024-03-12 at 10 47 12 AM

from mixpanel-swift.

ttmdung203 avatar ttmdung203 commented on September 18, 2024

@jaredmixpanel for visibility.

from mixpanel-swift.

jaredmixpanel avatar jaredmixpanel commented on September 18, 2024

@ttmdung203 That's not the correct way to initialize and use the Mixpanel instance. You don't need to store the instance. You should always use the shared instance provided by Mixpanel.mainInstance():

Mixpanel.initialize(token: token, trackAutomaticEvents: true)
Mixpanel.mainInstance().delegate = self
Mixpanel.mainInstance().useIPAddressForGeoLocation = false
...
Mixpanel.mainInstance().track(event: "My Event")

Try that and let me know if it makes a difference.

from mixpanel-swift.

ttmdung203 avatar ttmdung203 commented on September 18, 2024

Thanks for your quick response, @jaredmixpanel
I've just tried the way you suggested, the city sometimes is sent to Mixpanel when I open app.

Reproduce steps:

  • Open app and open some screens (to track screen viewed event), then close and open app again (to flush events automatically).
  • Repeat it until seeing the city in mixpanel. (It happens ~5-10% the time I do above steps).
Mixpanel.initialize(token: token, trackAutomaticEvents: true)
Mixpanel.mainInstance().useIPAddressForGeoLocation = false
Mixpanel.mainInstance().delegate = self

...
Mixpanel.mainInstance().track(event: "Event name")
```

from mixpanel-swift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.