public PersonIncrementEvent CreatePersonIncrementEvent()
        {
            this.AssertValidProjectToken();
            var personEvent = new PersonIncrementEvent();

            this.OnCreatePersonEvent(personEvent);
            return(personEvent);
        }
        public PersonIncrementEvent CreatePersonIncrementEvent(String distinctId)
        {
            this.AssertValidProjectToken();
            var personEvent = new PersonIncrementEvent();

            personEvent.DistinctUserId = distinctId;
            this.OnCreatePersonEvent(personEvent);
            return(personEvent);
        }
Exemplo n.º 3
0
        protected virtual void WriteIncrementJson(JsonWriter writer, PersonIncrementEvent personEvent)
        {
            // https://mixpanel.com/docs/people-analytics/people-http-specification-insert-data
            //{
            //    "$add": {
            //          "dollars spent": 17,
            //          "credits remaining": -34 // Subtract by passing a negative value
            //    },
            //    "$token": "36ada5b10da39a1347559321baf13063",
            //    "$distinct_id": "13793"
            //}

            writer.WriteStartObject();
            writer.WritePropertyName("$add");
            writer.WriteRawValue(personEvent.Increments.ToPropertyArrayJson(Formatting.None) ?? "{}");
            this.WriteCommonPersonValues(writer, personEvent);
            writer.WriteEnd();
        }
 protected virtual void OnCreatePersonEvent(PersonIncrementEvent personEvent)
 {
     personEvent.ProjectToken = this.ProjectToken;
 }