function zoddakSendStats(data){
    jQuery.post(
        RS_ZODDAK_STATS.ajax_url,
        {
            action: 'zoddak_rs_send_stats',
            property_ref: data.ref,
            event: data.event,
            extraData: data.extraData || null,
            user_agent: navigator.userAgent,
            session_id: zoddakGetSessionId(),
            lang: navigator.language || null,
            mobile:  /Mobi/i.test(navigator.userAgent) ? 'mobile' : 'desktop'
        }
    )
    .done((response) => {
    })
}

function zoddakGetSessionId(){
    let sid = localStorage.getItem('session_id');

    if(!sid){
        sid = 'sess' + Math.random().toString(36).substring(2) + Date.now();
        localStorage.setItem('session_id', sid);
    }
    return sid;
}

window.zoddakSendStats = zoddakSendStats;