Last active
June 2, 2025 18:54
-
-
Save robisatthefunction/2eeff8394914dedb815f9229c9f9a79d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getUserInfo(user_id){ | |
// Add logic to check if (store_id_boolean is in local storage and not expired value) | |
fetch('https://tapi.optimizely.com/api/js/odds/project/<project_id>?project=<project_id>&c_user_id=' + user_id).then(function (response) { | |
// The API call was successful! | |
return response.json(); | |
}).then(function (data) { | |
// Recommended to cache this user data for a period of time so you are not making requests for user info on every page load | |
return data | |
}).catch(function (err) { | |
// There was an error | |
console.warn('Something went wrong.', err); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment