分析跟踪Youtube iframe在我的网站上

Analytics track Youtube iframe on my website

本文关键字:我的 网站 iframe 跟踪 Youtube      更新时间:2023-09-26

我试图跟踪在我的网站上显示的视频的视图。为了显示视频,我使用iframe:

<iframe width="640" height="400" src="https://www.youtube.com/embed/Videoid?autoplay=1" style="" frameborder="0" allowfullscreen></iframe>

现在我必须添加如下内容:

&utm_source=website&utm_medium=click&utm_campaign=campName

我已经将这个尾url附加到我想要跟踪的页面中的其他对象(facebook链接,下载链接,ecc…)并且它有效。所以我尝试了这个解决方案,但它不起作用:

<iframe width="640" height="400" src="https://www.youtube.com/embed/VideoId?autoplay=1&utm_source=website&utm_medium=click&utm_campaign=campName" style="" frameborder="0" allowfullscreen></iframe>

有什么区别?只有iframe性质或Youtube想要以另一种方式进行呼叫?我在stackOverflow和谷歌上读过一些东西,解决方案似乎是迁移到youTube api逻辑,但如果可能的话,我想使用iframe。还有另一种方法可以包含尾部url:

&utm_source=website&utm_medium=click&utm_campaign=campName

在Iframe?

通过在启动视频的按钮上插入onclick事件解决:

onclick="_gaq.push([‘_trackEvent’, ‘extlink’, ‘click’, ‘Showvideo’]);"