News for hackers. Stuff that matters.
Re:Mobile Analytics Platform Amplitude (YC W12) Takes On Flu... by seivan on Thursday February 20, 2014 @06:06PM (#7274308)
You probably want to do three things

1) Extract all network layer into its own stuff. We built an SDK recently, and I decided to make three layers out of it. SDK -> OAuth2 -> Networking

2) Separate that 1000 lines of code into several classes (check #1)

3) Update your device naming https://github.com/seivan/mixpanel-iphone/blob/feature/prope...

You guys will run into a case where your users will pollute their tracking with unknown model names because your SDK was outdated on the naming.

Even if they do update the SDK, the users will have ton of data with the old naming.

I'd probably store the device naming map on the server side in case of new devices without having to update the SDK.

Also, write tests, add a sample app, add your cocoapod spec file to your repo as well - etc.

Re:Mobile Analytics Platform Amplitude (YC W12) Takes On Flu... by sskates on Thursday February 20, 2014 @06:23PM (#7274382)
Thanks for the suggestions!

We're on cocoapods, have tests, and a sample app locally but haven't pushed all that to Github to keep things simple for everyone looking at the source.

Model name tracking is an issue- we've fixed it in our backend so we can remap unknown names to display the correct thing on our website interface. We just haven't yanked the code from the SDK.

Agree on rearchitecting it with separation of concerns. We have to be very careful with any changes we push. The code's already running successfully on 10MM phones without any issues and we have to make sure not to introduce any new ones- so that process takes a while. Thanks again!

Re:Mobile Analytics Platform Amplitude (YC W12) Takes On Flu... by je42 on Thursday February 20, 2014 @06:51PM (#7274499)
If you have a complete suite of unit tests, integration tests and system tests, you should not have fear on refactoring your code.

Question: do you store events that could be not send in a persistent store to retry at a later stage ?

Re:Mobile Analytics Platform Amplitude (YC W12) Takes On Flu... by sskates on Thursday February 20, 2014 @07:50PM (#7274747)
It's true that tests are very helpful for this. However there are a lot of bugs in the wild that are difficult to reproduce, especially ones that will only crop up under rare conditions of state. It's as Linus said- "There really are only two acceptable models of development: think and analyze or years and years of testing on thousands of machines". Years and years of testing on thousands of machines happens to be the best predictor of code that runs correctly.
Re:Mobile Analytics Platform Amplitude (YC W12) Takes On Flu... by je42 on Thursday February 20, 2014 @06:55PM (#7274520)
Ok, and next question: logRevenue why only accept dollar ? This puts the burden of estimating dollar revenue received from different currencies on your customer. ( which is a common case for global mobile apps... )
Re:Mobile Analytics Platform Amplitude (YC W12) Takes On Flu... by sskates on Thursday February 20, 2014 @07:51PM (#7274750)
It's not a dollar amount, but any NSNumber value. We'll provide support for localization down the line.
Re:Mobile Analytics Platform Amplitude (YC W12) Takes On Flu... by je42 on Thursday February 20, 2014 @06:52PM (#7274508)
[Amplitude generateRandomId]; --> is that persistent per device ?
Re:Mobile Analytics Platform Amplitude (YC W12) Takes On Flu... by sskates on Thursday February 20, 2014 @09:07PM (#7275011)
It's persistent across app opens, not across installs though. We were using AdvertiserID for tracking but Apple started clamping down on that so we've switched over to to vendor ID, which they explicitly recommend for things like this.
Re:Mobile Analytics Platform Amplitude (YC W12) Takes On Flu... by je42 on Thursday February 20, 2014 @06:56PM (#7274527)
setUserId --> do you propagate the user id backwards to events of the same session that were sent before the user id was set ?
Re:Mobile Analytics Platform Amplitude (YC W12) Takes On Flu... by sskates on Thursday February 20, 2014 @09:08PM (#7275012)
Yes, we tie the two data sets together.
Re:Mobile Analytics Platform Amplitude (YC W12) Takes On Flu... by je42 on Friday February 21, 2014 @05:49PM (#7279988)
Cool, that can save a lot of headaches.