【问题标题】:Mixpanel Push Notification iosMixpanel 推送通知 ios
【发布时间】:2016-04-05 12:02:42
【问题描述】:

在 Mixpanel 管理员中,在通知下,如果我过滤指定设备,如下面的链接所示(基于电子邮件过滤-> 选择一封电子邮件发送给相应的设备用户)但“您的过滤器未返回匹配的用户” 如果我看到Mixpanel。我需要在人员分析中添加一些内容。因为这是处理通知的开始。我不知道为什么它不匹配用户。

 [[Mixpanel sharedInstance] .people set:@{@"Email":[pre objectForKey:@"SignInUserEmailId"]}];

这就是我在 Mixpanel People Analytics、Is It Right 或其他我需要为 People Analytics 做的事情的方式。

【问题讨论】:

    标签: ios objective-c mixpanel


    【解决方案1】:

    我终于找到了推送通知的解决方案,

    在“didRegisterForRemoteNotificationsWithDeviceToken”下

    Mixpanel *mixpanel = [Mixpanel sharedInstance];

    [混合面板识别:@"123456"];

    [mixpanel.people addPushDeviceToken:usertoken];

    你的 addPushDeviceToken 函数将负责 $union 操作。在该示例中,“123456”将是您为其注册推送令牌的不同 ID 的示例。如果你想在设备上使用当前的不同 ID,你会做 [mixpanel identify:mixpanel.distinctId]

    【讨论】:

      【解决方案2】:

      使用 Swift 推送通知。将以下代码放入 AppDelegate.swift 文件中

      如果应用已最小化,您也可以在代码和设备上接收通知。

      func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
          // Override point for customization after application launch.        
      
          let settings = UIUserNotificationSettings(forTypes: [.Alert, .Badge, .Sound], categories: nil)
          UIApplication.sharedApplication().registerUserNotificationSettings(settings)
          UIApplication.sharedApplication().registerForRemoteNotifications()
          return true
      }
      
      func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
      
          //pass the project token from mixpanel account
          let mixpanel = Mixpanel.sharedInstanceWithToken("4e35256cfd95a9b236936bcf0104bb92")
      
          mixpanel.identify("564") //564 is the unique distinct id of user
          mixpanel.people.set(["name": "your name", "$email": "email@email.com", "Plan": "Free", "$region" : "Australia"])
          mixpanel.people.addPushDeviceToken(deviceToken)        
      }
      
      func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
      
          var alert1: String = ""        
          if let aps = userInfo["aps"] as? NSDictionary {
              if let alert = aps["alert"] as? NSDictionary {
                  if let message = alert["message"] as? NSString {
                      //Do stuff
                  }
              } else if let alert = aps["alert"] as? NSString {
                  print(alert)
                  alert1 = alert as String
              }
          }        
          let alertController = UIAlertController(title: "Notification", message:
              alert1, preferredStyle: UIAlertControllerStyle.Alert)
          alertController.addAction(UIAlertAction(title: "Dismiss", style: UIAlertActionStyle.Default,handler: nil))
      
          UIApplication.sharedApplication().keyWindow?.rootViewController?.presentViewController(alertController, animated: true, completion: nil)
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2017-04-19
        • 2011-08-07
        • 1970-01-01
        • 2018-06-18
        • 2016-05-19
        相关资源
        最近更新 更多