Esempio n. 1
0
def identify():
    posthog.identify(
        options.distinct_id,
        anonymous_id=options.anonymousId,
        traits=json_hash(options.traits),
        context=json_hash(options.context),
    )
Esempio n. 2
0
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("上报用户名称出错了呜呜呜 ~")
Esempio n. 3
0
 def test_identify(self):
     posthog.identify('distinct_id', {'email': '*****@*****.**'})
     posthog.flush()
Esempio n. 4
0
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"})
Esempio n. 5
0
# 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': '*****@*****.**'})
Esempio n. 6
0
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)
Esempio n. 7
0
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)
Esempio n. 8
0
 def test_identify(self):
     posthog.identify("distinct_id", {"email": "*****@*****.**"})
     posthog.flush()