migrated mixpanel code to new JS framework