Exemple #1
0
    private bool Engage(string distinctId, IDictionary<string, object> setProperties = null, 
      IDictionary<string, object> incrementProperties = null) {
      // Standardize token and time values for Mixpanel
      var dictionary = 
        new Dictionary<string, object> {{"$token", token}, {"$distinct_id", distinctId}};

      if (setProperties != null) dictionary.Add("$set", setProperties);

      if (incrementProperties != null) dictionary.Add("$add", incrementProperties);

      var data = new JavaScriptSerializer().Serialize(dictionary);

      var values = "data=" + data.Base64Encode();

      var contents = _options.UseGet
        ? http.Get(Resources.Engage(_options.ProxyUrl), values)
        : http.Post(Resources.Engage(_options.ProxyUrl), values);

      return contents == "1";
    }