When do I call mixpanel.people.identify - mixpanel

How do I tell mixpanel the userID of my logged on user?
Do I need to call mixpanel.people.identify() everytime my user logs in, or only the first time that I'm creating them on mixpanel?
If only the first time, how does mixpanel know who to associate events to?
Also, once I have identified the person, will all events be tracable to that person, or do I need to call people.set() explicitly to track a generic event separately from a user-specific event?

You should call mixpanel.people.identify() every time a user logs in. You can even call it every time a page loads in a logged in state if you want.
identify sets some data in a cookie about what distinct_id the library should use when sending people data.
If you have called mixpanel.identify with the same distinct_id as mixpanel.people.identify, events that you send (with mixpanel.track) will show up under the user's profile on the Customers tab. In order for the user to show up at all, though, you will need to call mixpanel.people.set (or .add) at least once.
EDIT: mixpanel.people.identify is no longer necessary; you can just call mixpanel.identify and it will set both.

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?

Check availability of resource used by another user

Building a web application.
User have access trough their browser to shared resources host on a server, however if UserA is already using Resource1, Resource1 should not be available to UserB until UserA release Resource1 or until a given amount of time.
For this part : I chose to use a MySQL table with a list of tuples (resource,currentuser) and run a cron task to delete expired tuples.
Now I want to be able to notify UserA that UserB wants to access Resource1 and if get not answer from UserA, then UserA lost his lock on Resource1 and then the Resource is then available to UserB.
For this part, I guess I have to use AJAX. I have thought about the following solution :
User's browser make periodic AJAX call (let's say each minute) to prove he is still alive and upon a call, if another User has requested the same resource, he has to challenge a server request in a given amount of time(for example a captcha). If the challenge fails, it means the user is not here anymore (maybe he left his browser opened or the webpage unfocused).
The tricky part is : "he has to challenge a server request in a given amount of time (for example a captcha)". How to do that?
Am I following the best path ?
Yes, what you've outlined is fine. Using ajax is also completely fine, especially if you're simply polling every minute.
For example, let's say you have the following:
setInterval(function() {
$.get('/resource/status', function(response) {
if (response.data.newRequest) {
//This would signal a new request to the resource
}
})
}, 60000)
When handling the new request to access the resource, you could use something like reCaptcha and display that however appropriate (overlay or inline). When you do this, you could also start a timer to determine if it's exceeded the amount of time allocated or not. If it has, then you can do another ajax request and revoke this person's access to the resource, or however you want to handle that.
i would use web sockets to control all the users that need to get the resource.
this way you will know who is connected and using the resource and when he finish using it you can let the next user the resource and so on ,
(this way can tell each user an estimation of how much time it will take him to get the resource and do some progress bar)
I think there're two problems here.
How to notify users that resource becomes available?
Periodic AJAX requests might be okay, but you can also consider long-polling or websockets to get close to notifying waiting users in real time.
How to find out that resource is still used by user?
If you want to catch the moment when human user is not doing anything on page, you can track mouse movement/clicking or keyboard button pressing. If nothing is done for last n minutes, the page might be considered as not active.
If you want to make sure that page is not exploited by automated software, you can ask to fill in captcha once in n minutes when resource is being used.

Registered user First visit url displays flash message

I would like to create middleware and check if registered user has already visited current URL and if not display flash message.
This feature i need just to show up tour on particular page so new user can understand what to do next.
I do realize that i can do it by store data in user table for each user but maybe there is another way to do such thing?
Thank you.
This may go quite complex depending on number of your routes. Why
don't you just make it simple:
1. Whenever user signup just store a session say session()->put('show_tour', true);
2. Now, show the flash-message on every page for registered user by checking this session value.
3. Make a button to disable this tour in your flash message. Make an AJAX call to destroy this session.

How to track anonymous events in Mixpanel

mixpanel's documentation says that
tracker.track(user_id, 'Sent Message')
which requires a user_id to be the source of the event.
What do I do if the user isn't logged it or the event just happens without the user interaction? for example, a redirect caused by some dynamic data
is there a way to track event (with the ruby api) that isn't matched to a user?
It is possible to track an event without a distinct_id (aka user_id) at the API level, but it's not a good idea because this event will not be usable in any report except "Segmentation" with the "Total" parameter (i.e. it will be useless in Segmentation+Unique, Retention, and Funnel reports). At that point, it's likely better to just not send anything, since it can never be attributed to a user.
If you're really just looking for counts of an event, you can simply generate a UUID. Don't default to -1, null, or another catchall as this can have unintended consequences.

Magento - Adminhtml - Get id of order just created

I want to do some post processing on an order, made using admin panel.
I have subscribed to the controller_action_postdispatch_adminhtml_sales_order_create_save event, and the correct function of this observer is being invoked.
How can I get the id of the order just saved in the saveAction in my function.
Mage_Adminhtml_Model_Sales_Order doesn't appear to save the order in the session anywhere, so this may be tough with the event you've chosen. In fact, the controller action you specified calls _getSession()->clear() to lose all the data from the session.
I would suggest finding a different event to use.

Resources