Google analytics 谷歌分析跟踪代码未启动

Google analytics 谷歌分析跟踪代码未启动,google-analytics,Google Analytics,我有这个跟踪代码,我不知道我还能做些什么让它着火。当页面加载时,什么都没有发生,没有错误,我只是看不到数据被发送到谷歌 <script> if (hotelname == " foohotels") { document.write(<img height="1" width="1" border="0" alt="" src="https://www.googlefoo.com/xxxx/clk/pagead/conversion/xxxx/?label=H

我有这个跟踪代码,我不知道我还能做些什么让它着火。当页面加载时,什么都没有发生,没有错误,我只是看不到数据被发送到谷歌

<script>
  if (hotelname == " foohotels")
  {

    document.write(<img height="1" width="1" border="0" alt="" src="https://www.googlefoo.com/xxxx/clk/pagead/conversion/xxxx/?label=HPA&guid=ON&script=0&ord=$$random$$&data=xxx_partner_hotel_id%3Dhotel-name%3Bhct_base_price%3Dtotal%3Bhct_total_price%3Dtotal2%3Bhct_currency_code%3Dcurrency%3Bhct_checkin_date%3Darrival%3Bhct_length_of_stay%3Dnights%3Bhct_date_format%3D%Y-%m-%d%3Bhct_booking_xref%3Dbooking%3Bhct_ver%3D1.0.i"/>);

  }
</script>

if(hotelname==“foohotels”)
{
document.write();
}
两件事:

  • 语法:
    document.write()
    需要一个字符串,介于单引号或双引号之间(幸好字符串可以包含其他类型)。因为你的东西已经包含双引号了,我建议用单引号括起来:

    document.write(“通过留下4个空格来创建代码,它把整个段落都写下来了,而没有留下空格。这就是谷歌分析代码吗?正如@Tushar所指出的,你的代码似乎不是谷歌分析代码。不过,你缺少document.write命令的引号,这将抛出一个错误。请尝试document.write(“”);而是Google TravelADSServices.com的转换代码