PageSourceSearch

https://poclanos.com/drmvsn/wp-content/plugins/duracelltomi-google…alytics-talk-content-tracking.js?ver=1.11.6

js poclanos.com collected 2026-09-26 09:39:27 UTC 3,725 bytes, 138 lines download raw bytes

1/*
2 * Source: http://cutroni.com/blog/2012/02/21/advanced-content-tracking-with-google-analytics-part-1/
3 * Original authors:
4 *  - Nick Mihailovski
5 *  - Thomas Baekdal
6 *  - Avinash Kaushik
7 *  - Joost de Valk
8 *  - Eivind Savio
9 *  - Justin Cutroni
10 *
11 * Google Tag Manager dataLayer events added by:
12 *   Thomas Geiger
13 *   gtm4wp.com
14 */
15
16if ( "undefined" == typeof console ) {
17	window.console = {
18		log: function () {}
19	};
20}
21
22jQuery( function( $ ) {
23	// Debug flag
24	var debugMode      = gtm4wp_scrollerscript_debugmode;
25
26	// Default time delay before checking location
27	var callBackTime   = gtm4wp_scrollerscript_callbacktime;
28
29	// # px before tracking a reader
30	var readerLocation = gtm4wp_scrollerscript_readerlocation;
31
32	// Set some flags for tracking & execution
33	var timer       = 0;
34	var scroller    = false;
35	var endContent  = false;
36	var didComplete = false;
37
38	// Set some time variables to calculate reading time
39	var startTime = new Date();
40	var beginning = startTime.getTime();
41	var totalTime = 0;
42
43	// Track the aticle load
44	if ( !debugMode ) {
45		window[ gtm4wp_datalayer_name ].push({
46			'event': 'gtm4wp.reading.articleLoaded'
47		});
48	} else {
49		console.log( 'Article loaded' );
50	}
51
52	// Check the location and track user
53	function trackLocation() {
54		bottom = $( window ).height() + $( window ).scrollTop();
55		height = $( document ).height();
56
57		// If user starts to scroll send an event
58		if ( bottom > readerLocation && !scroller ) {
59			currentTime = new Date();
60			scrollStart = currentTime.getTime();
61			timeToScroll = Math.round( ( scrollStart - beginning ) / 1000 );
62
63			if ( !debugMode ) {
64				window[ gtm4wp_datalayer_name ].push({
65					'event': 'gtm4wp.reading.startReading',
66					'timeToScroll': timeToScroll
67				});
68			} else {
69				console.log( 'Started reading ' + timeToScroll );
70			}
71			scroller = true;
72		}
73
74		// If user has hit the bottom of the content send an event
75		if ( bottom >= $( '#' + gtm4wp_scrollerscript_contentelementid ).scrollTop() + $( '#' + gtm4wp_scrollerscript_contentelementid ).innerHeight() && !endContent ) {
76			currentTime = new Date();
77			contentScrollEnd = currentTime.getTime();
78			timeToContentEnd = Math.round( ( contentScrollEnd - scrollStart ) / 1000 );
79
80			if ( !debugMode ) {
81				window[ gtm4wp_datalayer_name ].push({
82					'event': 'gtm4wp.reading.contentBottom',
83					'timeToScroll': timeToContentEnd
84				});
85			} else {
86				console.log( 'End content section ' + timeToContentEnd );
87			}
88
89			endContent = true;
90		}
91
92		// If user has hit the bottom of page send an event
93		if ( bottom >= height && !didComplete ) {
94			currentTime = new Date();
95			end = currentTime.getTime();
96			totalTime = Math.round( ( end - scrollStart ) / 1000 );
97
98			if ( !debugMode ) {
99				if ( totalTime < gtm4wp_scrollerscript_scannertime ) {
100					window[ gtm4wp_datalayer_name ].push({
101						'event': 'gtm4wp.reading.readerType',
102						'readerType': 'scanner'
103					});
104				} else {
105					window[ gtm4wp_datalayer_name ].push({
106						'event': 'gtm4wp.reading.readerType',
107						'readerType': 'reader'
108					});
109				}
110
111				window[ gtm4wp_datalayer_name ].push({
112					'event': 'gtm4wp.reading.pagebottom',
113					'timeToScroll': totalTime
114				});
115			} else {
116				if ( totalTime < gtm4wp_scrollerscript_scannertime ) {
117					console.log( 'The visitor seems to be a "scanner"' );
118				} else {
119					console.log( 'The visitor seems to be a "reader"' );
120				}
121
122				console.log( 'Bottom of page ' + totalTime );
123			}
124
125			didComplete = true;
126		}
127	}
128
129	// Track the scrolling and track location
130	$( window ).scroll(function() {
131		if ( timer ) {
132			clearTimeout( timer );
133		}
134
135		// Use a buffer so we don't call trackLocation too often.
136		timer = setTimeout( trackLocation, callBackTime );
137	});
138});

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.