@@ -122,7 +122,7 @@ Example:
122122 "Birthday": "1948-01-01"})
123123*/
124124func (mp * Mixpanel ) PeopleSet (id string , properties * P ) error {
125- return mp .PeopleUpdate (id , & P {
125+ return mp .PeopleUpdate (& P {
126126 "$distinct_id" : id ,
127127 "$set" : properties ,
128128 })
@@ -138,12 +138,62 @@ Example:
138138 mp.PeopleSetOnce("12345", &P{"First Login": "2013-04-01T13:20:00"})
139139*/
140140func (mp * Mixpanel ) PeopleSetOnce (id string , properties * P ) error {
141- return mp .PeopleUpdate (id , & P {
141+ return mp .PeopleUpdate (& P {
142142 "$distinct_id" : id ,
143143 "$set" : properties ,
144144 })
145145}
146146
147+ /*
148+ PeopleIncrement Increments/decrements numerical properties of people record.
149+
150+ Takes in JSON object with keys and numerical values. Adds numerical
151+ values to current property of profile. If property doesn't exist adds
152+ value to zero. Takes in negative values for subtraction.
153+ Example:
154+ mp.PeopleIncrement("12345", &P{"Coins Gathered": 12})
155+ */
156+ func (mp * Mixpanel ) PeopleIncrement (id string , properties * P ) error {
157+ return mp .PeopleUpdate (& P {
158+ "$distinct_id" : id ,
159+ "$add" : properties ,
160+ })
161+ }
162+
163+ /*
164+ PeopleAppend appends to the list associated with a property.
165+
166+ Takes a JSON object containing keys and values, and appends each to a
167+ list associated with the corresponding property name. $appending to a
168+ property that doesn't exist will result in assigning a list with one
169+ element to that property.
170+ Example:
171+ mp.PeopleAppend("12345", &P{ "Power Ups": "Bubble Lead" })
172+ */
173+ func (mp * Mixpanel ) PeopleAppend (id string , properties * P ) error {
174+ return mp .PeopleUpdate (& P {
175+ "$distinct_id" : id ,
176+ "$append" : properties ,
177+ })
178+ }
179+
180+ /*
181+ PeopleUnion Merges the values for a list associated with a property.
182+
183+ Takes a JSON object containing keys and list values. The list values in
184+ the request are merged with the existing list on the user profile,
185+ ignoring duplicate list values.
186+ Example:
187+ mp.PeopleUnion("12345", &P{ "Items purchased": ["socks", "shirts"] } )
188+ */
189+ func (mp * Mixpanel ) PeopleUnion (id string , properties * P ) error {
190+ return mp .PeopleUpdate (& P {
191+ "$distinct_id" : id ,
192+ "$union" : properties ,
193+ })
194+ }
195+
196+
147197
148198func parseJsonResponse (resp * http.Response ) error {
149199 type jsonResponseT map [string ]interface {}
0 commit comments