<script>
window.econda = {
onReady: [], ready: function (f) {
this.onReady.push(f);
}
};
let haseSend = false;
{% block startOfScript %}
{% endblock %}
{% block default %}
window.emos3 = window.emos3 || {
defaults : {
content: window.location.pathname,
siteid: '{{ 'econda_site_id'|trans }}',
pageId: '{{ page_type_tracking |default(page_type| default('other')) }}',
'tecdata': [[null, '{{ page_type_tracking |default(page_type| default('other')) }}']],
},
stored : [],
send : function(p){this.stored.push(p);}
};
{% endblock %}
{% block send %}
window.emos3InitialSend = function() {
if (!haseSend) {
const econdaSend = {{ econdaSend|default|json_encode|raw }};
if (econdaSend !== "") {
window.emos3.send(econdaSend);
} else {
window.emos3.send({});
}
haseSend = true;
}
}
{% endblock %}
document.addEventListener('econdaClickEvent', function (event) {
let data = {
name: event.detail.name,
type: 'c_add',
pid: event.detail.sku,
sku: event.detail.sku,
price: event.detail.price,
group: event.detail.category,
count: event.detail.quantity,
var1: null,
var2: null,
var3: null
};
window.emos3.send({
ec_Event: [
data
]
});
});
document.addEventListener('loginEvent', function (event) {
if(event.detail.email !== '') {
window.emos3.send({login: [event.detail.email, event.detail.hasError ?? 1]});
}
})
document.addEventListener('phainaInterviewIdAdded', function (event) {
if(event.detail.interviewId !== '') {
econdaSend = {};
econdaSend.productfinderid = [[event.detail.interviewId]];
window.emos3.send(econdaSend);
}
})
</script>