<script type="text/javascript">
function downloadCount(type){
var ajaxparameter="downloaded="+type;
var xmlhttp=new XMLHttpRequest();
var glurl="logger.jsp";
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
}
}
xmlhttp.open("POST",glurl,true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send(ajaxparameter);
}
</script>
<td>
<a class="dnld" onclick="function handleDownloadLinks(event)
{
ga('send', 'event', 'Download', 'Click', 'ForwardIC_4.0.war');
};
downloadCount("ForwardIC_4.0.war");"
href="https://example.com/pub/infocenter/Forward/Release4.0/ForwardIC_4.0.war">
<img src="images/download.gif" alt="Download" border="0" style="margin-right:3px">Download</a>
</td>
当他们单击链接时,我正在尝试跟踪文件名(由用户下载(。正在跟踪页面视图,但未跟踪下载事件,即未在 GA 控制台中反映文件名
快速浏览一下,我无法检测到错误,但您应该仔细遵循本文中描述的一些模式如何在onclick事件中调用多个JavaScript函数? .这将分离 Ajax 调用与 ga 下载事件。试一试
此外,"
表示双引号("(。所以它可能会给你一个错误。尝试添加带有单引号 ('( 的文件名。