# Console error: Piwik page tracker and Lazy Loading Attribute

**URL:** <https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342>\
**Category:** Data collection and tags\
**Created:** [June 7, 2023, 2:38pm UTC](https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342 "2023-06-07T14:38:27Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elena\_Benito\_Ruiz](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/elena_benito_ruiz/32/1823_2.png) [@Elena\_Benito\_Ruiz](https://community.piwik.pro/u/Elena_Benito_Ruiz)\
**Post date:** [June 7, 2023, 2:38pm UTC](https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342/1 "2023-06-07T14:38:27Z")

</div>

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”

 ![Screenshot 2023-06-02 at 10.15.10](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/5/5233b8d9dc90436b3c73056feae0ba9a4bcd2078.png)

Would this fix for GTM work for Piwik Tag Manager?

> **[Fix Lazy-Loaded YouTube Video Tracking on Google Tag Manager](https://medium.com/sparkline/fix-lazy-loaded-youtube-video-tracking-on-google-tag-manager-9c4c577848bd)**
>
> Lazy loading is a technique of delaying load of webpage resources until they are actually needed to improve page load performance. This is…

Thanks!

---

<div class="post-metadata">

**Author:** ![Adam](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/adam/32/1494_2.png) [@Adam](https://community.piwik.pro/u/Adam)\
**Post date:** [June 9, 2023, 8:23am UTC](https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342/2 "2023-06-09T08:23:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Elena\_Benito\_Ruiz](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/elena_benito_ruiz/32/1823_2.png) [@Elena\_Benito\_Ruiz](https://community.piwik.pro/u/Elena_Benito_Ruiz)\
**Post date:** [June 9, 2023, 8:45am UTC](https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342/3 "2023-06-09T08:45:30Z")

</div>

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

> **[The true cost of employees: FREE guide + Excel to calculate costs](https://beebole.com/blog/how-to-calculate-the-real-cost-of-an-employee/)**
>
> Calculate the true cost of employees: How much does an employee cost? How factors affect base salary? FREE Excel + Video Tutorial

---

<div class="post-metadata">

**Author:** ![Adam](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/adam/32/1494_2.png) [@Adam](https://community.piwik.pro/u/Adam)\
**Post date:** [June 12, 2023, 8:36am UTC](https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342/4 "2023-06-12T08:36:09Z")

</div>

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.

 ![with PP2](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/3/3a204c0ca88bc7c37dac006b896dd0118098d453.png)

 ![with PP](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/1/13bdd61fcce5f92a6e7722858ebd00dad7e56825.png)  
 ![without PP2](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/8/8de9abb146f7e79c1c83a2ff6a3bd94b7d950185.png)  
 ![without PP](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/6/6f36ad5c6b23749ba16e721c7737fe3512dc6c54.png)

---

<div class="post-metadata">

**Author:** ![Elena\_Benito\_Ruiz](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/elena_benito_ruiz/32/1823_2.png) [@Elena\_Benito\_Ruiz](https://community.piwik.pro/u/Elena_Benito_Ruiz)\
**Post date:** [June 15, 2023, 12:21pm UTC](https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342/5 "2023-06-15T12:21:04Z")

</div>

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._"

---

<div class="post-metadata">

**Author:** ![Elena\_Benito\_Ruiz](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/elena_benito_ruiz/32/1823_2.png) [@Elena\_Benito\_Ruiz](https://community.piwik.pro/u/Elena_Benito_Ruiz)\
**Post date:** [June 16, 2023, 5:35pm UTC](https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342/6 "2023-06-16T17:35:53Z")

</div>

Hi,  
Anyone can help on this?  
Thanks!

---

<div class="post-metadata">

**Author:** ![Adam](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/adam/32/1494_2.png) [@Adam](https://community.piwik.pro/u/Adam)\
**Post date:** [June 19, 2023, 7:38am UTC](https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342/7 "2023-06-19T07:38:39Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![Elena\_Benito\_Ruiz](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/elena_benito_ruiz/32/1823_2.png) [@Elena\_Benito\_Ruiz](https://community.piwik.pro/u/Elena_Benito_Ruiz)\
**Post date:** [June 20, 2023, 12:53pm UTC](https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342/8 "2023-06-20T12:53:48Z")

</div>

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?”

 ![piwik-yt-console-error](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/1/1e55d35dcf9ec1ef85713202699f776dc2983af3.jpeg)

---

<div class="post-metadata">

**Author:** ![Adam](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/adam/32/1494_2.png) [@Adam](https://community.piwik.pro/u/Adam)\
**Post date:** [June 21, 2023, 6:53am UTC](https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342/9 "2023-06-21T06:53:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Elena\_Benito\_Ruiz](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/elena_benito_ruiz/32/1823_2.png) [@Elena\_Benito\_Ruiz](https://community.piwik.pro/u/Elena_Benito_Ruiz)\
**Post date:** [June 24, 2023, 5:01pm UTC](https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342/10 "2023-06-24T17:01:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Adam](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/adam/32/1494_2.png) [@Adam](https://community.piwik.pro/u/Adam)\
**Post date:** [June 26, 2023, 7:57am UTC](https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342/11 "2023-06-26T07:57:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Elena\_Benito\_Ruiz](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/elena_benito_ruiz/32/1823_2.png) [@Elena\_Benito\_Ruiz](https://community.piwik.pro/u/Elena_Benito_Ruiz)\
**Post date:** [June 26, 2023, 7:26pm UTC](https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342/12 "2023-06-26T19:26:06Z")

</div>

Thanks @Adam no problem.

---

<div class="post-metadata">

**Author:** ![Adam](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/adam/32/1494_2.png) [@Adam](https://community.piwik.pro/u/Adam)\
**Post date:** [July 5, 2023, 9:06am UTC](https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342/13 "2023-07-05T09:06:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Elena\_Benito\_Ruiz](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/elena_benito_ruiz/32/1823_2.png) [@Elena\_Benito\_Ruiz](https://community.piwik.pro/u/Elena_Benito_Ruiz)\
**Post date:** [July 5, 2023, 10:59am UTC](https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342/14 "2023-07-05T10:59:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Adam](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/adam/32/1494_2.png) [@Adam](https://community.piwik.pro/u/Adam)\
**Post date:** [July 14, 2023, 9:32am UTC](https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342/15 "2023-07-14T09:32:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Elena\_Benito\_Ruiz](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/elena_benito_ruiz/32/1823_2.png) [@Elena\_Benito\_Ruiz](https://community.piwik.pro/u/Elena_Benito_Ruiz)\
**Post date:** [July 17, 2023, 5:05pm UTC](https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342/16 "2023-07-17T17:05:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Elena\_Benito\_Ruiz](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/elena_benito_ruiz/32/1823_2.png) [@Elena\_Benito\_Ruiz](https://community.piwik.pro/u/Elena_Benito_Ruiz)\
**Post date:** [July 31, 2023, 10:31am UTC](https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342/17 "2023-07-31T10:31:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Adam](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/adam/32/1494_2.png) [@Adam](https://community.piwik.pro/u/Adam)\
**Post date:** [July 31, 2023, 11:01am UTC](https://community.piwik.pro/t/console-error-piwik-page-tracker-and-lazy-loading-attribute/2342/18 "2023-07-31T11:01:21Z")

</div>

Hi Elena,

Happy to hear that! Have a great week.
