-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update alias docs #82
base: master
Are you sure you want to change the base?
Conversation
c4a298b
to
33ccc37
Compare
or | ||
|
||
```python | ||
posthog.alias('distinct id', '[email protected]') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks like a bad example. The [email protected]
doesn't look like an anonymous session ID to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
People use aliasing is several ways, not just for anonymous session ids. E.g. if you want to be able to identify users by their email as well as their distinct ID. But I guess we don't need this example in the library doc and instead can just have it in the posthog.com docs
"distinct_id": previous_id, | ||
"alias": distinct_id, | ||
"distinct_id": distinct_id, | ||
"alias": previous_id, | ||
}, | ||
"timestamp": timestamp, | ||
"context": context, | ||
"event": "$create_alias", | ||
"distinct_id": previous_id, | ||
"distinct_id": distinct_id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we swapping the order here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our docs we tell people to use the ordering posthog.alias(distinct_id, alias). However, the parameter names are the wrong way round for this so I've updated the parameter names. Even in the current version we're actually sending it the right way (but in a fairly hacky way where we send the distinct_id as the alias because the user actually gives the alias in place of the distinct_id). I've put in a regression test to confirm that it doesn't change user functionality (apart from named args, as the named args actually refer to the opposite thing)
@@ -41,9 +41,9 @@ | |||
|
|||
print(posthog.feature_enabled("beta-feature", "distinct_id")) | |||
|
|||
# # Alias a previous distinct id with a new one | |||
# Add an alias_id to a distinct_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not clear to me what alias_id restrictions are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we are removing the alias restrictions with the new updates of persons on events enabling person merging?
Update the alias call to match how aliasing actually works. It was the wrong order
Important: this doesn't change the API for positional arguments, but it does change it for named arguments. It seems that previously if you used distinct_id it would actually send this as the alias ID