When a user logs into the account, you may want to display info about the user's points, tier, referral code etc.

Use the Javascript API call get_loyalty_user_info() to implement this solution. Suppose you want to display the number of points next to the Rewards program link on the top bar as shown below. 

Here is a sample code snippet.

<script type="text/javascript">
window.get_user_info = function(){
if(typeof(zrl_mi) =='undefined'){
setTimeout(window.get_user_info, 100)
}
else{
zrl_mi.get_loyalty_user_info();
}
}
window.zrlmi_loyalty_user_info_success_handler = function(data){
var message = "You have " + data.available_points + " points available. Click here to check your account and redeem your points.";
msg_el = $("#loyalty-message")[0];
if(msg_el){
msg_el.innerHTML = message;
}
header_icon = $("#loyalty-points-count")[0];
if(header_icon){
header_icon.innerHTML = data.available_points;
}
}
window.get_user_info();
</script>

Did this answer your question?