Guest User

Untitled

a guest
May 20th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. extension MixpanelTweaks {
  2. public static let isGpsEnabled = Tweak(
  3. tweakName: "gps_enabled",
  4. defaultValue: false)
  5. }
  6.  
  7.  
  8. func application(
  9. _ application: UIApplication,
  10. didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
  11. Mixpanel.initialize(token: "TOKEN")
  12. let allTweaks: [TweakClusterType] = [MixpanelTweaks.isGpsEnabled]
  13. MixpanelTweaks.setTweaks(tweaks: allTweaks)
  14. Mixpanel.mainInstance().identify(distinctId: "userId")
  15. Mixpanel.mainInstance().checkForVariantsOnActive = true
  16. Mixpanel.mainInstance().loggingEnabled = true
  17.  
  18. //There are already created profiles on mixpanel website that matches the courier id
  19. Mixpanel.mainInstance().people.set(property: "courier_id", to: "courierId-333")
  20.  
  21. Mixpanel.mainInstance().joinExperiments(callback: {
  22. // Get the boolean value of a/b test for the courierId-333
  23. let isGpsEnabled: Bool = MixpanelTweaks.assign(MixpanelTweaks.isGpsEnabled)
  24. print("@@@@@@@@@@@ isGpsEnabled=\(isGpsEnabled)")
  25. })
  26.  
  27. return true
  28. }
Add Comment
Please, Sign In to add comment