All Collections
iFrame Embed
General
Customer Authentication
Customer Authentication
Seanalee Greenough avatar
Written by Seanalee Greenough
Updated over a week ago

For Customer Authentication, the zingfit iframe will fire an event ( 'zingfitAuthentication' ) that you can listen for using the javascript snippet below. When the customer is authenticated the event will contain the customerId and firstName. With this event you will be able to do things such as:

  • know a customer is authenticated

  • display their name in the header

  • show a different set of menus when the customer is authenticated

function customerAuth(e){
    if(e.detail && e.detail.customerId){
        // customer is logged in
        console.log('customerId: ' + e.detail.customerId);
        console.log('firstName: ' + e.detail.firstName);
    }else{
        // customer is not logged in
    }
}window.addEventListener('zingfitAuthentication', customerAuth, false);
Did this answer your question?