Mixpanel — delete user with all past data - mixpanel

I'm working on adding Mixpanel for my project. After logging some crappy data at first, I deleted the user from Mixpanel, deleted it from my test database, and gone through registration again.
However, since I used DeviceUDID as Mixpanel's distinct id, it was the same for the new user — and when I opened Mixpanel, I saw the deleted user ressurected, with all old data and events in his profile.
How can I delete this old user forever?

yes, you can delete a user permanently from Mixpanel. Here is how:
{
"$token": "YOUR_TOKEN",
"$distinct_id": "DISTINCT_ID_TO_REMOVE",
"$delete": ""
}
You have to encode it in Base64 (e.g. with this tool: https://www.base64encode.org/) and append the base64-encoded data as url parameter to http://api.mixpanel.com/engage/
The example would look like this: http://api.mixpanel.com/engage/?data=ew0KICAgICIkdG9rZW4iOiAiWU9VUl9UT0tFTiIsDQogICAgIiRkaXN0aW5jdF9pZCI6ICJESVNUSU5DVF9JRF9UT19SRU1PVkUiLA0KICAgICIkZGVsZXRlIjogIiINCn0=

Related

Google drive API delete file updates the last modified date

There is a different behavior from Google Drive UI and Google Drive API, when removing a file.
Using Google Drive UI:
remove a file, it will go to trash folder and the Last Modified Date is still the same. (if user restore the file, still there is no change on last modified date)
Using Google Drive API:
delete a file, it will go to trash folder, BUT the Last Modified date is changed and if user restore the file, there will be a new modified date.
to me API behavior is more correct, because there is an action made to the file, therefore modified date should change, but how come Google UI doesn't change the Last Modified date ?
Thanks,
This does appear to be an inconsistency between the UI and the API, although what the correct behavior should be is debatable. I've reached out the engineering team to see if they can bring the two paths inline. In the meantime, you can trash a file without changing the modifiedDate by instead using a Files.patch() request and setting the modifiedDateBehavior parameter to "noChange":
PATCH https://www.googleapis.com/drive/v2/files/...?modifiedDateBehavior=noChange
{
"labels": {
"trashed": true
}
}

How can I show user's first name to the user after the user logged in

I am using Ion_Auth and I have a problem. I have looked for the solution but there is no progress yet.
As an example, there is a user and his name is Alex.
When Alex is logged in the portal, He should see his name Alex and then if he clicked his name, he will go to his user settings to edit his details. The problem is I can't show the first_name when a user have logged in.
How can I do that? I don't know what codes I can publish for this situation. Tell me what you need as code, I can publish if you need.
Having never used Ion_Auth, I decided to have a look at the repository on GitHub. You could use the user_id and pass this to a model method to get the first name (like umefarooq has suggested).
However, I would pull the first name from the database and store it in the session when the user logs in. This means you don't have to go back to the database just to get their name.
You can see in the Ion_auth model, this line;
$query = $this->db->select($this->identity_column . ', username, email, id, password, active, last_login')
https://github.com/benedmunds/CodeIgniter-Ion-Auth/blob/2/models/ion_auth_model.php#L985
You could just add the first name row to this query, and it will be added to the session when the user logs in.
You can then access it by:
$this->session->userdata('FirstName');
Hope this helps.
The easiest way is:
$user = $this->ion_auth->user()->row();
echo $user->first_name;
When the user logged in successfully, store his/her first name into the session variable.
then call the specific session variable on where you want to display.

DocsList findFolder() issue

This is a google spreadsheet script question.
I have a GUI setup in order to search for "SouthWest" and then find a "test" sheet. This is the code I am using.
var file = DocsList.getFolder("SouthWest").find("test");
This works just fine when I run it under my account (as I have this folder and file setup correctly) but when another user is logged into google docs it will attempt to search for this folder/file under the new user instead of the owner of the document. Is there a way to have it just search the DocsList of the owner of the spreadsheet that is currently open? The error that I get under the new user is "Error encountered: Cannot find folder SouthWest." Thanks.
If you always want to access the same file, you can use the getFileById method and address it directly instead of searching every time:
https://developers.google.com/apps-script/class_docslist#getFileById
Of course, you should make sure that all users are allowed to access that file.

Sync mailchimp campaign click and open with some other database

I am working on mailchimp integration.
I need to pull campaign stats (opens and clicks) and put it in my local database.
Using mailchimp api i am getting the list of all the users with their action taken.
But my issue is how to keep data sync at all time.
Is there any way to skip that data from mailchimp api that i had synced already.
The problem is the entire data set can change between calls and there is no 'since' parameter... The only way to get an updated picture is to query all records and update....
Keeping stat "data synced at all times" really would just depend on your solution (have it query for updates when you/your users access that section...)
You could expidite the update process by keeping track of previous calls/updates with the timestamp (keep track of the timestamp and only update/add records that are newer than the last sync... )
As I said, there is currently no "since" command for the campaignEmailStatsAIMAll method (and no direct equivelent in the export API...)
A 'since' parameter would actually be a good feature... So if coding your own solution to track updates via the timestamp is undesirable, you may want to ask the question in the google group or post a feature request in the google code project:
http://code.google.com/p/mailchimp-api/
EDIT: I just opened the feature request as it may solve a similar issue for an upcomming project:
http://code.google.com/p/mailchimp-api/issues/detail?id=60

In CakePHP 1.3 is there any advantage of using $this->Controller->Session over $this->Session in a component?

I'm using a modified version of Felix Geisendörfer's SimpleAuth/SimpleAcl components that I've combined into a single Component, Simple_Authable.
I changed his startup() function to initialize() to not clutter the beforeFilter function in my app_controller.
One of the things that this component does is check who the active user is and if that user can't be found it either looks him up based on the primary User.id or uses 'guest'. Either way, the component uses $this->Controller->Session->write() to save the active user or guest information.
I'm also using Felix's Authsome plugin instead of the default CakePHP Auth component.
When I'm logging in, the active user is guest, obviously.
After I've submitted the form, the active user is still guest because the component's initialize() function is firing before everything else. Then, the Authsome plugin comes into play and validates my user as "root" and also calls $this->SimpleAuthable->setActiveUser($id, true); to force SimpleAuthable to update the active user information it is storing via $this->Controller->Session; Then I am redirected and my simple Session information and DebugKit's Session tab reflect that I am indeed the root user.
However, when I try to navigate to an 'admin' page, let's say /admin/users/index, lo and behold SimpleAuthable thinks I'm still a 'guest' user because when it performs a $this->Controller->Session->read() call to the key holding my user id, it is getting an empty response, i.e., the data stored on the previous page didn't persist.
Maybe there is something funky happening between Authsome & SimpleAuthable, but things look pretty straightforward and to my mind, $this->Controller->Session should be saving and persisting the data written to it.
So, I'm looking at refactoring all the calls to $this->Controller->Session and replacing them with $this->Session but first I wanted to throw this out to the community and see if anybody has seen anything similar and if so how did they resolve it.
Sincerely,
Christopher.
I found the problem... I'm also using Joshua McNeese's Permissionable plugin and I needed to disable it for the $this->Controller->{$this->userModel}->findById($id); in my SimpleAuthable component when I try to lookup the current active user.
Note to self: I would have caught this faster if I had some unit testing in place :(.

Resources