Expand my Community achievements bar.

YouTube embed video tracking - console error

Avatar

Level 2

We've implemented YouTube embed video tracking, some embed videos are throwing us the following error.

 

Access to XMLHttpRequest at 'https://googleads.g.doubleclick.net/pagead/viewthroughconversion/something' (redirected from 'https://www.youtube.com/pagead/viewthroughconversion/something') from origin 'https://www.youtube.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

 

Kindly help us to sort out this console error. Thank You.

 

8 Replies

Avatar

Community Advisor

Check that your youtube.com URL has the "origin" parameter: https://developers.google.com/youtube/iframe_api_reference#Loading_a_Video_Player

If it does, then I believe you can safely ignore this error. Your video tracking should still work properly.

Avatar

Level 2

Thank you. I can't ignore this error because tracking is not working if this error is thrown. My URL has an origin parameter. Video tracking functions work properly if the origin parameter is missing from the URL. This error is thrown and tracking is not working if the origin parameter is provided.

Is it possible to track the video using the origin parameter?

Avatar

Community Advisor

Could you provide the YouTube URL + origin parameter that you tried but failed?

Avatar

Level 2

https://demo.xerago.com/website/DigitalAnalytics/Sathya/TestPage/ This is my testing URL. I have added a YouTube URL with the origin parameter in the iframe on this site. Could you please check?

Avatar

Community Advisor

Hmm, you're right. When the "origin" parameter is there, tracking doesn't work. When the "origin" parameter is removed, then tracking works. Yet in both cases, the error is thrown.

I suppose you can ignore the error since it doesn't affect your page nor your video.

Avatar

Level 2

I can't remove the "origin" parameter while still wanting to track the video events because the Business has inserted it for security reasons.

 

Avatar

Community Advisor

Alright.

I wonder why your tracking fails when the "origin" parameter is present. In all of my tests and even with my client sites, I can track normally when the YouTube URL contains the "origin" parameter. So I'm not able to replicate your problem.