handle <source> and at least one error

This commit is contained in:
Deborah Barnard
2024-06-27 14:22:02 +01:00
parent d74c840c37
commit ffac5b2b9d
2 changed files with 16 additions and 1 deletions

View File

@@ -79,13 +79,27 @@ https://plausible.io/docs/script-extensions?ref=ryansechrest.com#all-our-script-
return;
}
// Add event listeners
videos.forEach((video) => {
videos.forEach((video) => {
// for <video src="">
if (video.src) {
videoTrackingObj[new URL(video.src).pathname] = {
"played": false,
"played25": false,
"played50": false,
"played75": false
}
} else if (video.getElementsByTagName('source').length > 0) {
videoTrackingObj[new URL(video.getElementsByTagName('source')[0].src).pathname] = {
"played": false,
"played25": false,
"played50": false,
"played75": false
}
} else {
let currentPage = window.location.href;
fetch('https://internal.users.n8n.cloud/webhook/docs-video-not-tracking?docsPage='+currentPage);
}
video.addEventListener("play", trackVideoPlayWithPlausible);
video.addEventListener("timeupdate", trackTimeIntervalsWithPlausible);
video.addEventListener("ended", trackVideoEndedWithPlausible);

View File

@@ -10,6 +10,7 @@ This is the documentation for [n8n](https://n8n.io/){:target=_blank .external-li
It covers everything from setup to usage and development. It's a work in progress and all [contributions](/help-community/contributing/) are welcome.
## Where to start
<div class="grid cards" markdown>