Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
#Check if user already has been gated into loading the Sprig SDK
user_flag = check_sprig_flag(user_id)
# if user state is not set, randomly determine if user is gated in
if user_flag is NULL: user_flag = flag_user() end
# if user state is true, load the Sprig SDK
if user_flag is True: load_sprig() end
# example function definitions below # ============
function check_sprig_flag(user_id):
#logic that should look up a user's flag in database/storage by user ID.
# if flag exists, return it
# if flag does not exist return NULL
return flag
function flag_user(): # logic to determine if user should be feature flagged into Sprig goes here
# store this flag in reference to user ID in database/storage, so that
# check_sprig_flag() function can reference it on next application load
return flag
function load_sprig():
# load SDK based on whichever environment you're using
Was this page helpful?