Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google analytics GA事件跟踪不';行不通_Google Analytics_Event Tracking - Fatal编程技术网

Google analytics GA事件跟踪不';行不通

Google analytics GA事件跟踪不';行不通,google-analytics,event-tracking,Google Analytics,Event Tracking,我有以下代码: <a onclick="ga('send','event','contactform','submit');"><input type="submit" name="button" id="button" value="Submit"/></a> 我还尝试: <input onclick="ga('send','event','contactform','submit');" type="submit" name="button"

我有以下代码:

<a  onclick="ga('send','event','contactform','submit');"><input type="submit" name="button" id="button" value="Submit"/></a>

我还尝试:

<input onclick="ga('send','event','contactform','submit');" type="submit" name="button" id="button" value="Submit"/>


当点击提交按钮时,我在(实时)谷歌分析中看不到任何东西。我担心我的实现出了问题。

试着将它包装成一个类似的函数

function test(){


    ga('send', 'event', 'Videos', 'play', 'Fall Campaign');

}
然后执行


尽管我认为这个问题可能与GA代码的实现有关。您是否使用插件将Google Analytics代码放置在网站上?

安装GA Debugger以查看是否有任何内容发送到GA,或者检查开发控制台网络选项卡中的点击率。另外,请确保没有过滤器删除你的点击。我安装了GA调试器,它工作正常,因为当我访问网站时,我可以实时看到我有+1个访问者。控制台显示“ga”未定义。您是否使用GTM?如果你是,那么你不应该使用像那样的内联代码来跟踪GA。我没有使用GTM,如果没有解决办法,我可以安装它。你是否在所有页面的顶部都包含了正常的、标准的GA跟踪片段?您看到的消息似乎表明您没有创建GA对象的权限。OP已经提到,
GA
未定义,因此包装器也无法工作。可能不会,但我还没有评论权限。我想问他们是否使用插件来放置分析代码。这会让我更好地了解设置的方式。如果实现不正确,则可能是未定义“ga”的原因