I an developing a chrome extension which doesn't has any sign up or sign in flow, instead depends on authentication of a separate web app. I started integrating mixpanel and tracking user events anonymously, Now i want to identify those anonymous users using "alias" and "identify" api. I have a user_id for identifying users from the web app exposed REST api. Now if i apply a boolean check and make sure i call mixpanel "alias(user_id)" once and call "identify(user_id)" every time user visits a page, I can see a user entry in explore tab of mixpanel but live events tab has a anonymous user with same user_id and its tracked data, I wish to link such anonymous users with appropriate user profiles.
Please help me with this if you have some understanding of mixpanel. I am new at this.
Since I didn't had a sign in or sign up flow, I cannot use
mixpanel.alias
Hence i am now calling
mixpanel.identify
As soon as user installs the plugin, Since "identify" api can be called any number of times for an user, We are able to track all future events as soon as plugin gets installed.
This way by not letting the user generate anonymous events we can handle such situation.
Related
I want to get all the sign up & sign in with Google events of my Google Workspace users using API.
I can see the Tokens activity from my Google Workspace admin account, under the audit log (https://admin.google.com/u/5/ac/reporting/audit/token), but it's limited to first sign ups, and doesn't show any of the following sign in events of my users.
Is there any way to see all the events related to third parties sign ins / sign ups of my users? is there any place that lists the summary of all of the third parties linked to users in my organization?
As far as a summary, you can retrieve a list of applications authorized by your users using the Directory API tokens.list method.
Unfortunately when it comes to OIDC sign in events, there currently is no way to see when users are logging into a 3rd party application. You will see activity events for tools accessing Google APIs, but not for login.
I guess you could use tokens.delete to revoke access, making the users re-authorize to log in again (which will be logged). But that's a rather heavy handed approach.
I think I've found what you're after:
https://developers.google.com/admin-sdk/reports/v1/guides/manage-audit-tokens
You can use this api call to retrieve all authorization events for third party applications.
The general format of such requests is below (parameters are surrounded by a double asterix)
GET https://www.googleapis.com/admin/reports/v1/activity/users/all
/applications/token?endTime=**end date**&startTime=**start date**
&maxResults=**maximum number of events returned on a response page**
Hopefully this gets you the info you want. I don't have access to a google admin account myself so I can't test this api call.
I have a single page application with some user-related calendars. The task is to write integration with the google calendar. A user should be able to click on 'integrate with google calendar', select his google account, give read+write access to the calendar, and then the application should be able to do a number of things within the user google calendar like creating a new calendar and sync all events inside it with the application data.
I started with this example, https://developers.google.com/calendar/quickstart/js
It works, but as I understand it's for online front end work only. Is it possible to retrieve authentication from this front end and send it to the back end? I want back end to operate server-to-server mode, while the user is offline.
I have checked the other, back end gapi integrations, but they do not look so cool, there're some redirects. I want to keep everything inside a single page with ajax and popups.
In order to access a users data when the user is off line you need something called offline access. When you authecate the user you will need to request offline access then the server will return to you a refresh token.
A refresh token is long lived you will be able to use your refresh token at anytime to request a new access token which will allow you to access the users data.
You cant use offline access with JavaScript you will need to use a server sided language like say node.js, php, phython .... you will not be able to use gapi
In the documents of Google One-Tap sign in, it says:
Returning users are signed in automatically, even when they switch devices or platforms, or after their session expires.
Question 1:
But it doesn't say anywhere how it does this? Is the user refresh token saved in the browser's cache? How can it then auto log in a user cross devices?
Question 2: The reason I ask is because I have a setup where I initialize the Google API client for JavaScript ("GAPI"). The GAPI library also automatically logs in a user whenever the client is "initialised" through gapi.client.init().
Now the problem is that after I have added the Google One-Tap code (Or should I say "YOLO code"? : ) my user gets logged in through One-Tap and also through GAPI. I can prevent this by not initializing the GAPI client, but I don't think that's wise, because I thought this whole library is built to manage my refresh tokens etc. Is my understanding correct that One-Tap does exactly the same and in case I only want to Authenticate users I do not need the GAPI client anymore?
Really, which library does a better job at managing my refresh tokens? And how do they differ? I'm clueless...
The way I implemented my login is the following:
Try to login in the user first using gapi.auth2. Maybe the user was previously signed into the site.
If can't login user automatically, then use googleyolo to try to find existing user accounts.
If no existing accounts, then present a signin button for user to signin.
I can give you some code snippet if you need.
To answer your questions.
#1, the credential is stored within the browser/device. If the user has never signed into google in a device, then yolo won't be able to sign in the user.
#2. googleyolo will also login the user, the difference is that it will give the account selector even if there's only one user to select (it will automatically login the user if there's only one). gapi simply sign in the user without showing anything.
I'm developing a web console to control much of the operations on my company. We heavily use Mixpanel and keep some info in the Mixpanel user profile. I need to be able to directly link to each of these profiles from my web console. I have the alias used to create the profile, but I don't have Mixpanel's unique Id. For example:
Some user
Any ideas?
Mixpanel automatically generate its distinct id. You must only once call mixpanel.alias('unique_key') where as you must use mixpanel.identify('unique_key ') everytime for sending the events to mixpanel that will automatically link to the auto generated mixpanel distinct id.
I’m having an issue with Mixpanel identification. I want to be able to track events logged before the user logs in and identify them as such.
Here’s an exemple. Louie opens the webpage and visits the “About” page. Using mixpanel.track('Visit About'), I’m able to log Louie’s anonymous visit. All is fine and dandy.
Louie decides to log in, and a mixpanel.identify(user.id) call identifies him — and subsequent events can be tracked back to Louie. However, the first event (“Visit About”) still shows up with a random, Mixpanel-set distinct ID and hasn’t been associated with Louie.
Is this behaviour expected? What can I do? Cheers
You want alias.
From their Javascript API reference:
Use alias() when a unique ID is first assigned (registration), and use identify() to identify the user with that unique ID on an ongoing basis (e.g., each time a user logs in after registering). Do not call identify() at the same time as alias().
From your description, it sounds like, rather than viewing the "About" page anonymously and then logging in, Louie is viewing the "About" page anonymously and then signing up.
In that case, call alias when Louie signs up, and call identify when he logs in after that. That should associate the random, anonymous Mixpanel ID with Louie's new registered user ID.
Note: using this method will mean that, because Louie triggered an event anonymously and then logged in, Louie's anonymous id for that event will not be linked to his distinct id from logging in. If he had signed up after triggering the anonymous event, you would call alias, and they would be linked. This is a known limitation of Mixpanel, unfortunately. From their documentation:
This is the first time he's accessed your site from this device, so we assign a brand new distinct_id to him. He clicks around and then logs in. You should not call mixpanel.alias() in this situation - we haven't seen him on this device, but he is not a new user. ... Instead of calling mixpanel.alias() you should just call mixpanel.identify(). This will remap his phone activity to the original ID he used when signing up for your service, which is the most desirable outcome. This does mean that regrettably the events he fired before logging in will not be associated with him.
More about aliasing in Mixpanel here.
It took them a while, but here it is...
It's called Mixpanel Identity merge and it should fix the whole problem of connecting the actions an anonymous user did before signing up /logging in
The new system improves the behavior of identify(), alias(), and adds a new event called $merge.
All pre-authentication activity can now be mapped back to a user
The ID merge system makes it possible to link pre and post authenticated event streams under a single identifier. This eliminates “false-uniques”, ensuring the most accurate conversion and drop-off rates in funnels and flows.
Previously, Mixpanel could only map pre-sign up activity back to a user who was later identified. Any activity a user did anonymously before signing in again could not be attributed to that user.
Here is the whole blog post
Alias doesn't work for the scenario when existing user logs in, but I found work around for this.
When a user first logs in, check to see if the distinct_id of the request cookie matches the user id.
If they don't match, create a backend task to backfill the anonymous distinct_Id to the user's distinct_id.
Load the events with JQL, then fire them again using the mixpanel import endpoint.
The downside is that you will have duplicate events in the system since there are no way to delete events from the anonymous distinct_id.
For the imported events, you can add a property to them indicating that they are imported so they can be filtered out if need be.