谷歌事件跟踪不起作用


Google event tracking not working

我正在使用事件跟踪下载按钮。当任何用户单击下载按钮时,必须运行此事件,但这不会发生。这是我的代码

<input  id="changesubmittxt_<?php echo $theme['Theme']['id']; ?>" type="submit" value="Proceed" class="submitButton" onclick="onClick="_gaq.push(['_trackEvent', 'themes', 'theme', 'free theme',, true]);"" />

所以告诉我哪里错了,哪里把所有参数都传对了,或者我在这里遗漏了什么。感谢

不确定这是否是打字错误,但您在onClick中有onClick。所以首先要解决这个问题。

此外,请检查trackEvent方法的引用https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEventTracking

具体说来:

您可以使用以下任意可选参数:opt_label、opt_value或opt_noninteraction。如果只想为第二个或第三个可选参数提供值,则需要为前面的可选参数传入undefined。

所以你应该试试

<input  id="changesubmittxt_<?php echo $theme['Theme']['id']; ?>" type="submit" value="Proceed" class="submitButton" onclick="_gaq.push(['_trackEvent', 'themes', 'theme', 'free theme', undefined, true]);" />