how to do mixpanel.people.increment in Segment - mixpanel

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!

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());

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.

Related

GA3 Event Push Neccesary fields in Request

I am trying to push a event towards GA3, mimicking an event done by a browser towards GA. From this Event I want to fill Custom Dimensions(visibile in the user explorer and relate them to a GA ID which has visited the website earlier). Could this be done without influencing website data too much? I want to enrich someone's data from an external source.
So far I cant seem to find the minimum fields which has to be in the event call for this to work. Ive got these so far:
v=1&
_v=j96d&
a=1620641575&
t=event&
_s=1&
sd=24-bit&
sr=2560x1440&
vp=510x1287&
je=0&_u=QACAAEAB~&
jid=&
gjid=&
_u=QACAAEAB~&
cid=GAID&
tid=UA-x&
_gid=GAID&
gtm=gtm&
z=355736517&
uip=1.2.3.4&
ea=x&
el=x&
ec=x&
ni=1&
cd1=GAID&
cd2=Companyx&
dl=https%3A%2F%2Fexample.nl%2F&
ul=nl-nl&
de=UTF-8&
dt=example&
cd3=CEO
So far the Custom dimension fields dont get overwritten with new values. Who knows which is missing or can share a list of neccesary fields and example values?
Ok, a few things:
CD value will be overwritten only if in GA this CD's scope is set to the user-level. Make sure it is.
You need to know the client id of the user. You can confirm that you're having the right CID by using the user explorer in GA interface unless you track it in a CD. It allows filtering by client id.
You want to make this hit non-interactional, otherwise you're inflating the session number since G will generate sessions for normal hits. non-interactional hit would have ni=1 among the params.
Wait. Scope calculations don't happen immediately in real-time. They happen later on. Give it two days and then check the results and re-conduct your experiment.
Use a throwaway/test/lower GA property to experiment. You don't want to affect the production data while not knowing exactly what you do.
There. A good use case for such an activity would be something like updating a life time value of existing users and wanting to enrich the data with it without waiting for all of them to come in. That's useful for targeting, attribution and more.
Thank you.
This is the case. all CD's are user Scoped.
This is the case, we are collecting them.
ni=1 is within the parameters of each event call.
There are so many parameters, which parameters are neccesary?
we are using a test property for this.
We also got he Bot filtering checked out:
Bot filtering
It's hard to test when the User Explorer has a delay of 2 days and we are still not sure which parameters to use and which not. Who could help on the parameter part? My only goal is to update de CD's on the person. Who knows which parameters need to be part of the event call?

Mixpanel alias on multiple devices

I'm confused by the way that Mixpanel alias() is supposed to work, despite the fact that Mixpanel have multiple pages attempting to explain it.
According to this page, I should call alias() only once per user, because it will create a one-time mapping from their user ID to the device's generated ID. But shouldn't that mapping be the other way around? Let's say Bob starts my app on his phone and logs in, at which point I call alias() to map all his actions so far to his account. He then goes through the same process on his tablet - I would expect that I can then call alias() on that machine to do the same thing. But the page I mentioned specifically says not to do that, because it will map his user ID to that device's ID now.
I can call identify() on the multiple devices, but that does not link his previous events to his user ID.
I feel like I'm misunderstanding how this whole thing works, but I've now spent a few hours pondering this so I'm hoping it's confused someone else in the past too...
I always understood alias() as mapping the identifiers both ways. I've had a similar case as you. I'm almost sure that it does not matter how many times you alias and in which direction you alias the identifiers.
This is not authoritative though, but rather based on past usage and possibly-flawed understanding.
As they explain on their help documentation:
https://mixpanel.com/help/questions/articles/how-should-i-handle-my-user-identity-with-the-mixpanel-javascript-library
Ideal implementation
The ideal integration that will allow you to track users from anonymous browsing all the way through signup and subsequent logins:
When a new user signs up, call (once)
mixpanel.alias("YOUR_USER_ID")
When a user logs in, call
mixpanel.identify("YOUR_USER_ID")
Applying this to your question, you need to use identify when the user do login with the mobile and another time when he do it with the tablet.

Update highcharts chart series from meteor subscription in angularjs-meteor

The way I have been doing it so far is to use Meteor.call and reset all the series in the callback, adding all the points all over. I then fetch new data using $interval every 5 seconds or so. This is obviously not very efficient and my data set is growing.
Now I'm trying to switch to a Meteor subscription since it feels like the right tool for the job.
The first challenge was how to add (a single time) all the points that are already in the collection. I solved that by using the onReady callback of a subscription.
Now my question is: how do I process the subsequent updates to the series on the chart?
I have a helper collection which is supposed to receive the updates and although this works transparently when used in an ng-repeat, I find it difficult to interact with outside of this use case.
I tried to $watch it but the watcher does not trigger.
The Higcharts documentation has a pure Meteor example on how to do what I want: http://www.highcharts.com/blog/195-meteor-standalone, but how do can I adapt it for angularjs-meteor?
Use ng-highcharts, and make sure your series is linked to the helper result.

In Angularjs, can I $apply / render a single scope at a time?

I have a fairly complex app, with lots of different components that update frequently. For example, a clock.
Is it possible to call $apply / $digest on only a subsection of the page at once? I don't want to call every watcher on the page for every single clock tick, for example.
I know I can achieve this by bypassing $scope.$apply entirely, and just updating the clock elements manually in a directive. Is there any hope for me?
EDIT: Actually, it looks like MAYBE what I want is to dun $digest, starting on the scope I want to check, rather than $apply, since $apply kicks off the digest on $rootScope. Is this a valid way to do it?
http://plnkr.co/edit/C8aOswf46qx2GoD5uL9Y?p=preview
If your components are really decoupled, you could isolate those that generate frequent updates in their own angular app instance. They will have independent digest cycles.
Your apps can still communicate but there is a bit more overhead involved.
In order to have 2 apps, you have to manually start the applications (use bootstrap instead of ng-app).
See this example: http://plnkr.co/edit/K3bnACFi79g5Kh0kFS66?p=preview
Whenever you call $scope.$apply() it also calls $apply() on all scopes that fall within that scope. If you want to call $apply() on a limited section of a page then that section needs to have it's own scope, which you can do by adding a controller to that section of the page. Then you can use that controller to update the scopes within that section of the page using $scope.apply() on your section controller.
-- Edit --
See comments below for additional details about the differences between $apply and $digest.
Also see:
http://jimhoskins.com/2012/12/17/angularjs-and-apply.html
https://groups.google.com/forum/#!topic/angular/SSj61VOBBSc

How to trigger an action the moment a specific statement validates true?

In Xcode you can check when you hit a button, wether an integer is 9 (go to that page) or 7 (go to an other page). Is there a way to automatically trigger an action when the number becomes 60 for example? I know you can do this with a timer, that checks every second if the if statment is true. But is there an other way to achieve the same?
Most debuggers can watch a memory location and break the application when the content of that location changes. So if you want to find out why and where something changes, that's your way. If you want the user interface to respond to that change during normal (i.e. non-debug) operations, then you'd better add some code to the location where things change, to pass that event along.

Resources