PageSourceSearch

https://junglueck.de/cdn/shop/t/676/assets/product-finder-tracking.js?v=183941579283488170301732199906

js junglueck.de collected 2026-10-02 07:19:49 UTC 3,950 bytes, 2 lines download raw bytes

1const KLAVIYO_COMPANY_ID="Q2xsJy",NEWSLETTER_LIST_ID="VGc6yz";async function submitProductfinderEvent(eventData){const bs2Host="https://junglueck-events.bs2.beeclever-apps.de",headers={Accept:"application/json","Content-Type":"application/json","X-Origin":window.origin};let visitorId=localStorage?.getItem("visitorId");if(!visitorId){const response=await fetch(bs2Host+"/visitor.php",{type:"cors",method:"POST",headers});if(response.ok){const resJson=await response.json();resJson?.visitorId&&(localStorage.setItem("visitorId",resJson.visitorId),visitorId=resJson.visitorId)}}if(!visitorId)return;eventData.visitorId=visitorId,eventData.data=eventData.data||{},eventData.data.country="DE";const requestBody=JSON.stringify(eventData),path=bs2Host+"/event.php",body=new Blob([requestBody],headers);self.hasOwnProperty("browser")&&browser?.sendBeacon?browser.sendBeacon(path,body):window?.navigator?.sendBeacon?window.navigator.sendBeacon(path,body):fetch(path,{type:"cors",method:"POST",headers,body:requestBody})}async function triggerKlaviyoCompleteEvent(attributes){return klaviyo.identify({$email:attributes?.email}).then(()=>{console.log("Klaviyo tracking -> ","Completed Routinefinder Quiz",attributes?.properties),klaviyo.push(["track","Completed Routinefinder Quiz",attributes?.properties])})}async function createKlaviyoProfile(attributes){const payload={data:{type:"profile",attributes}},options={method:"POST",headers:{revision:"2024-07-15","content-type":"application/json"},body:JSON.stringify(payload)};return fetch("https://a.klaviyo.com/client/profiles?company_id="+KLAVIYO_COMPANY_ID,options).then(response=>response.text()).then(response=>{console.log("created klaviyo profile!",payload)}).catch(err=>console.error(err))}async function addProfileToNewsletter(attributes){const payload=JSON.stringify({data:{type:"subscription",attributes:{profile:{data:{type:"profile",attributes}},custom_source:"Productfinder"},relationships:{list:{data:{type:"list",id:NEWSLETTER_LIST_ID}}}}}),options={method:"POST",headers:{revision:"2024-07-15","content-type":"application/json"},body:payload};fetch(`https://a.klaviyo.com/client/subscriptions/?company_id=${KLAVIYO_COMPANY_ID}`,options).then(response=>response.text()).then(response=>{console.log(`subscribed klaviyo newsletter ${NEWSLETTER_LIST_ID} with profile!`,payload)}).catch(err=>console.error(err))}function submitDataToKlaviyo(attributes){createKlaviyoProfile(attributes).then(()=>triggerKlaviyoCompleteEvent(attributes)).then(()=>addProfileToNewsletter(attributes)).then(()=>{console.log("Submitted productfinder result to klaviyo",attributes)}).catch(error=>{console.error(error)})}window.addEventListener("productfinder:init",event=>{const productfinder_view_data={eventName:"quiz_view"};console.log(productfinder_view_data.eventName),submitProductfinderEvent(productfinder_view_data)}),window.addEventListener("productfinder:submit",event=>{const attributes=event?.detail?.attributes;attributes&&submitDataToKlaviyo(attributes)}),window.addEventListener("productfinder:question_answered",event=>{const productfinder_question_answered_data={eventName:"quiz_answer",data:event.detail};console.log(productfinder_question_answered_data.eventName,productfinder_question_answered_data.data),submitProductfinderEvent(productfinder_question_answered_data)}),window.addEventListener("productfinder:start",event=>{const productfinder_start_data={eventName:"quiz_start"};console.log(productfinder_start_data.eventName),submitProductfinderEvent(productfinder_start_data)}),window.addEventListener("productfinder:completed",event=>{const productfinder_end_data={eventName:"quiz_end"};console.log(productfinder_end_data.eventName),submitProductfinderEvent(productfinder_end_data)}),window.addEventListener("productfinder:closed",event=>{console.log({eventName:"quiz_end"}.eventName)});
2//# sourceMappingURL=/cdn/shop/t/676/assets/product-finder-tracking.js.map?v=183941579283488170301732199906

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.