Góly - body - sekundy
Streda 22.07.2015 19:50
Vhodné pre všetkých
Európska tvorba
Reláciu najbližšie vysielame
-
Piatok 20.12. 19:55
Repríza
-
Piatok 20.12. 19:55
-
Piatok 20.12. 22:15
-
Sobota 21.12. 02:00
Repríza
-
Sobota 21.12. 03:50
Repríza
-
Sobota 21.12. 04:50
Repríza
-
Sobota 21.12. 05:25
Repríza
document.addEventListener("DOMContentLoaded", function () {
let startTime = new Date().getTime();
let wordCount = window.dataLayer.find(item => item['attributes_news']?.article_word_count)?.['attributes_news']?.article_word_count || 0;
window.addEventListener("scroll", function () {
let scrollDepth = (window.scrollY + window.innerHeight) / document.documentElement.scrollHeight * 100;
if (scrollDepth >= 90) {
let timeSpent = (new Date().getTime() - startTime) / 1000;
window.dataLayer.push({
event: 'content_consumption',
article_word_count: wordCount,
scroll_depth: scrollDepth,
time_spent: timeSpent,
content_consumption_score: (scrollDepth / 100) * wordCount * timeSpent
});
console.log('Content consumption event pushed to dataLayer:', {
article_word_count: wordCount,
scroll_depth: scrollDepth,
time_spent: timeSpent,
content_consumption_score: (scrollDepth / 100) * wordCount * timeSpent
});
}
});
});