@snowplow/javascript-tracker
Version:
Web analytics for Snowplow
52 lines (48 loc) • 1.65 kB
HTML
<html>
<head>
<title>Page for HTML5 media tracking testing with Snowplow Micro</title>
<script>
const collector_endpoint = document.cookie.split('container=')[1].split(';')[0].trim();
document.body.className += ' loaded';
</script>
</head>
<body>
<script>
(function (p, l, o, w, i, n, g) {
if (!p[i]) {
p.GlobalSnowplowNamespace = p.GlobalSnowplowNamespace || [];
p.GlobalSnowplowNamespace.push(i);
p[i] = function () {
(p[i].q = p[i].q || []).push(arguments);
};
p[i].q = p[i].q || [];
n = l.createElement(o);
g = l.getElementsByTagName(o)[0];
n.async = 1;
n.src = w;
g.parentNode.insertBefore(n, g);
}
})(window, document, 'script', '../snowplow.js', 'snowplow');
document.write(collector_endpoint);
window.snowplow('newTracker', 'sp2', collector_endpoint, {
appId: 'html5-track-test',
});
window.snowplow('enableMediaTracking', {
id: 'html5',
options: {
captureEvents: ['DefaultEvents'],
boundaries: [95],
label: 'test-label',
},
});
</script>
<!--
The element must be muted to avoid:
javascript error: javascript error: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD
-->
<video id="html5" src="./test-video.mp4" height="250px" width="250px" controls muted>
<track kind="captions" label="English" src="./test-track.vtt" srclang="en" default />
</video>
</body>
</html>