4

I'm using Segment and have Mixpanel enabled. I used to track our user's life time revenue like this:

mixpanel.people.increment('Lifetime Revenue', 21.99);

The question is how do I do this in Segment? Looked everywhere, it seems like they do have increment setting under advanced setting. However, I still don't know how to fire those events/trackers.

Thanks!

jackhao
  • 3,457
  • 3
  • 22
  • 43

3 Answers3

4

I too was wondering on how to do this, based on Mixpanel's article (https://mixpanel.com/blog/2014/07/21/revenue-best-practices). I did a lot of back and forth with Segment's tech support, and after a couple of days of repeatedly telling them to read the article, they finally got me to an engineer who actually read it, and was able to answer my question about this as well. Here's his answer:

It looks like a few things need to happen for this lifetime revenue value to be tracked.

First, track_charge needs to be called. Fortunately we're already firing a track_charge call when revenue is passed as a trait in track calls. You can see where that happens in the code here.

Secondly, a the people.increment() needs to be called. We also fire this on the page as you can see here, but it doesn't look like we currently have a way to pass through the revenue in that people.increment call.

Looks like your best bet here would be to fire off the increment and set calls directly. As you may know, we're loading the Mixpanel library on the page so all you have to do is execute the calls within an analytics.ready() method. Doing so ensures that the native calls only fire when the Mixpanel library has properly loaded on the page.

For reference, here are the calls you'd want to place within the ready() method.

mixpanel.people.increment("Lifetime Value", 27); 
mixpanel.people.set("Last Item Purchase", new Date.toISOString()); 
James Nine
  • 2,548
  • 10
  • 36
  • 53
3

To increment events, log into your account at Segment.com, select the Mixpanel integration, then select "Advanced Options". Within "Advanced Options", there's a text field labeled "Events to Increment in People" where you can specify events you'd like to be incremented.

Alex L
  • 789
  • 9
  • 14
  • This isn't super helpful. So if I put in an event name like 'Killed a Monster', how do I specify that this event maps to the 'monsters_killed' property in Mixpanel? – Ali Dec 23 '19 at 14:58
0

you can use something like this

       // Call Mixpanel increment method here
        val mixpanel = AnalyticsManager.appAnalytics
        val properties: MutableMap<String, Int> = HashMap()
        properties["String you want to increment"] = 1
        mixpanel?.people?.increment(properties)
keshav
  • 96
  • 7