def identify(): posthog.identify( options.distinct_id, anonymous_id=options.anonymousId, traits=json_hash(options.traits), context=json_hash(options.context), )
async def upload_name(): me = await bot.get_me() try: posthog.identify(str(me.id), {'name': str(me.first_name)}) logs.info("上报用户名称成功。") except: logs.info("上报用户名称出错了呜呜呜 ~")
def test_identify(self): posthog.identify('distinct_id', {'email': '*****@*****.**'}) posthog.flush()
posthog.alias("distinct_id", "new_distinct_id") posthog.capture("new_distinct_id", "event2", { "property1": "value", "property2": "value" }) posthog.capture("new_distinct_id", "event-with-groups", { "property1": "value", "property2": "value" }, groups={"company": "id:5"}) # # Add properties to the person posthog.identify("new_distinct_id", {"email": "*****@*****.**"}) # Add properties to a group posthog.group_identify("company", "id:5", {"employees": 11}) # properties set only once to the person posthog.set_once("new_distinct_id", {"self_serve_signup": True}) time.sleep(3) posthog.set_once( "new_distinct_id", {"self_serve_signup": False }) # this will not change the property (because it was already set) posthog.set("new_distinct_id", {"current_browser": "Chrome"})
# Import the library import posthog import time # You can find this key on the /setup page in PostHog posthog.api_key = '' posthog.personal_api_key = '' # Where you host PostHog, with no trailing /. # You can remove this line if you're using posthog.com posthog.host = 'http://127.0.0.1:8000' # Capture an event posthog.capture('distinct_id', 'event', { 'property1': 'value', 'property2': 'value' }) print(posthog.feature_enabled('beta-feature', 'distinct_id')) print('sleeping') time.sleep(45) print(posthog.feature_enabled('beta-feature', 'distinct_id')) # # Alias a previous distinct id with a new one posthog.alias('distinct_id', 'new_distinct_id') # # Add properties to the person posthog.identify('distinct_id', {'email': '*****@*****.**'})
def identify(session_id: str, properties: Optional[dict] = None) -> None: properties = properties or {} properties.update(os=platform.system(), python_version=platform.python_version(), dp_version=__version__) with suppress(Exception): posthog.identify(session_id, properties)
async def handle_start(msg: Message, state): await state.finish() await redirect_to_main_menu() posthog.identify(msg.from_user.id, message_id=msg.message_id)
def test_identify(self): posthog.identify("distinct_id", {"email": "*****@*****.**"}) posthog.flush()