Google跟踪代码管理器和YouTube冲突 [英] Google Tag Manager & Youtube Conflict

查看:69
本文介绍了Google跟踪代码管理器和YouTube冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:该问题不再相关. GTM不再影响Youtube API. (在jsFiddle演示中,视频信息(状态,currentTime,持续时间)始终正确).

the problem is no longer relevant. GTM do not affect Youtube API anymore. (In the jsFiddle demo, video informations (state, currentTime, duration) are always correct).

调用Google跟踪代码管理器似乎破坏了YouTube API. 这是一个小提琴演示:

Calling the Google Tag Manager seems to wreck the Youtube API. Here is a fiddle demo :

Google跟踪代码管理器& YouTube(jsfiddle)

// where thoses methods do not work anymore
player.getPlayerState();
player.getCurrentTime();
player.getDuration();

通过注释第16行,Youtube API再次起作用(正确的状态,正确的currentTime/持续时间显示). 由于视频仍在播放,似乎js api已禁用.

by commenting the line 16 Youtube API works again (correct state, correct currentTime / duration displayed). Since the video is still playing, it seems like the js api is disabled.

有什么避免的想法吗?

推荐答案

您在小提琴中加载的GTM容器针对自定义JavaScript变量中的YouTube API进行了大量自定义.通过禁用/删除这些变量,页面上的YT方法应该可以再次使用.

The GTM container you load in the fiddle has a number of heavy customizations against the YouTube API in Custom JavaScript variables. By disabling / removing those variables, the YT methods on the page should work again.

因此,这将是您在GTM中创建的自定义JavaScript变量中的一个自定义脚本问题,而不是GTM内置功能的一个固有问题.

So this would be a custom scripting issue in the Custom JavaScript variables you have created in GTM, and not a native issue with GTM's built-in functionalities.

这篇关于Google跟踪代码管理器和YouTube冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆