Block YouTube iFrame API Without Consent
-
Hi,
your plugin loads the file https://www.youtube.com/s/player/26636eff/www-widgetapi.vflset/www-widgetapi.js without consent.
Its loaded from the file /wp-content/plugins/pixelyoursite-pro/dist/scripts/public.js .initYouTubeAPI: function() {
if (typeof window.YT === 'undefined') {
var tag = document.createElement('script');
tag.src = '//www.youtube.com/iframe_api';
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag)
}
if (typeof window.onYouTubeIframeAPIReady !== 'function') {
window.onYouTubeIframeAPIReady = function() {
var potentialVideos = Utils.getTagsAsArray('iframe').concat(Utils.getTagsAsArray('embed'));
for (var i = 0; i < potentialVideos.length; i++) {
var video = potentialVideos[i];
if (tagIsYouTubeVideo(video)) {
var iframe = normalizeYouTubeIframe(video);
addYouTubeEvents(iframe)
} else if (tagIsYouTubeAsyncVideo(video)) {
video.addEventListener("load", function(evt) {
var iframe = normalizeYouTubeIframe(evt.currentTarget);
addYouTubeEvents(iframe)
})
}
}
var targets = document.querySelectorAll('.elementor-widget-video .elementor-wrapper');
const config = {
attributes: !1,
childList: !0,
subtree: !0
};
const callback = function(mutationsList, observer) {
for (let mutation of mutationsList) {
if (mutation.type === 'childList') {
for (var m = 0; m < mutation.addedNodes.length; m++) {
addDynYouTubeVideos(mutation.addedNodes[m])
}
}
}
};
for (var i = 0; i < targets.length; i++) {
const observer = new MutationObserver(callback);
observer.observe(targets[i], config)
}
}
}
}How can I load this function only with consent?
I am looking for something like this:
pys.Facebook.loadPixel();
thank you very much. ??
JanEDIT:
“Track embedded YouTube or Vimeo video views” is disabled.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.