Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Update alias docs #82

wants to merge 3 commits into from

Conversation

lharries
Copy link
Contributor

@lharries lharries commented Jan 24, 2023

Update the alias call to match how aliasing actually works. It was the wrong order

Screenshot test_client py — posthog-python (Code) 2023-01-24 at 17 12@2x

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

or

```python
posthog.alias('distinct id', '[email protected]')

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

Copy link
Contributor Author

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

Comment on lines -252 to +258
"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,

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?

Copy link
Contributor Author

@lharries lharries Jan 24, 2023

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

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.

Copy link
Contributor Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants