Skip to content

Version 1.19.0

Choose a tag to compare

@softvar softvar released this 17 Feb 07:39
· 11 commits to master since this release
  • Added support to use the context id as the visitor UUID instead of auto-generating one. You can read the visitor UUID from the flag result via flag.get_uuid() (e.g. to pass to the web client).

    Example usage:

    from vwo import init
    
    # Initialize the SDK
    vwo_client = init({
        "account_id": "123456",
        "sdk_key": "32-alpha-numeric-sdk-key",
    })
    
    # Default: SDK generates a UUID from id and account
    context_with_generated_uuid = {"id": "user-123"}
    flag1 = vwo_client.get_flag("feature-key", context_with_generated_uuid)
    
    # Use your own UUID (e.g. from web client) by passing a valid web UUID as id
    context_with_custom_uuid = {
        "id": "D7E2EAA667909A2DB8A6371FF0975C2A5",  # your existing UUID
    }
    flag2 = vwo_client.get_flag("feature-key", context_with_custom_uuid)
    
    # Get the UUID from the flag result (e.g. to pass to web client)
    uuid = flag1.get_uuid()
    print("Visitor UUID:", uuid)