Console error: Piwik page tracker and Lazy Loading Attribute

This is a message from our WP developer on an error we keep getting on console whenever we have an embedded video on our posts:

“It is an error message that keeps getting generated from page load onwards (screenshot attached). The error is caused by the Piwik page tracker, in conjunction with the loading=“lazy” attribute which is placed on the YouTube iframe at the end of the article. I assume that Piwik is trying to access the iframe, but the iframe is not loaded, by default. The error messages stop at the moment the iframe enters the viewport and the content is loaded. Testing on my local dev, the error does not manifest when the Piwik tracking code is not present in the page source. Finally, the error only manifests for Chromium browsers - which have support for the loading=“lazy” attribute. Unfortunately, I couldn’t find any documentation on how to adjust the Piwik script to mitigate this scenario”

Would this fix for GTM work for Piwik Tag Manager?

Thanks!

Hi Elena,

Thank you for notifying about the issue. Could you please provide me with the link to the site where it occurs in the thread? If you prefer you can also send it to me in private message so I can check what exactly might be causing it.

Thanks Adam, no problem, for instance this post with an embedded video:

Hi Elena,

Thank you for the example link you sent. I checked it and it doesn’t seem to be a problem that come from Piwik PRO side. The error indicated to player widget itself. I also turned off Piwik PRO tracking script locally and the same error was visible in the console. Also, the video tracking works properly even though the error is visible in the console. Please take a look at the screenshots I attached. First two of them are with PP tracking enabled, the other two with PP tracking disabled locally.



thank you @Adam
Here I am copy-pasting the comment from our WP developer:

" Hi, Adam!

Thank you for your reply and for testing this issue at your end.

One aspect I fell I must underline is that the issue we’re concerned about is the error message stating: “Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘’) does not match the recipient window’s origin (‘’).”. From our tests, the error does not get generated in case we replicate the HTML of the example URL I sent you, with the single change being that we remove the Piwik tracking script altogether, from the section of the HTML source.

Moreover, in the case of Chromium browsers, the error messages stop being generated the moment that the video iframe enters the viewport (i.e. the video iframe finally loads, as a consequence of the loading=“lazy” attribute which is supported by Chromium browsers). From the looks of the screenshots attached by you, the video iframe is in view, in all 3 of them, which would explain why the error message does not get generated and why you cannot replicate the issue I’ve reported."

Hi,
Anyone can help on this?
Thanks!

Hi Elena,

I am sorry for late reply. I spoke about your issue with our developers and they recently introduced an update that fixes the issue you described. In order to apply the changes you need to again create a YouTube tracking tag. Please follow this approach and let me know if that fixed your problem :slight_smile:

Thank you @Adam I deleted the Youtube tag and I created a new one, as you said. However, errors are still triggered. See snapshot captured from our WP developer. And this is what he asks: “Is there anything that needs to be done, additionally, in the site theme, to accommodate the new Youtube Video Tracking tag?”

Hi Elena,

That’s unfortunate. Please let me get in touch with out developers regarding this issue again and I will get back to you as soon as I got answer from them.

Hi @Adam thanks for your help. Any progress on this one?
Cheers!

Hi Elena,

The works around this case are still in progress. Fortunately, as I can see the data is not affected with this issue and YouTube tracking works properly. I will let you know as soon as I receive feedback from our developers.

Thanks @Adam no problem.

Hi Elena,

Hope you’re fine!
I’ve just received feedback from our developers that the problem was fixed and planned date to release the updates is 17th of July. Also, it won’t require any actions from your side to avoid seeing this issue.

Have a wonderful day.

Thanks a lot @Adam for following up on this.
Looking forward to it.
And have a great day you too.

Hi Elena,

We introduced version 17.6.0 which contains adjustments for lazy loading video. Please confirm if the error is fixed on your side

hi @Adam I will, once our WP dev is back from deserved holidays and pings me on this. Thanks a lot for following up.

Thank you @Adam This has been solved with your latest fix. So all set!

Hi Elena,

Happy to hear that! Have a great week.