开发者

Google Analytics code error implementing in .asp file

开发者 https://www.devze.com 2023-03-26 05:10 出处:网络
I am implementing Google Analytics in a form page. The problem comes after the form is sent by a user.

I am implementing Google Analytics in a form page.

The problem comes after the form is sent by a user.

In the form landing page, the GA tracking code is partly duplicated in the body, creating duplicated stats for the landing page.

I've checked my asp file and have no clue on what I could be doing wrong.

I hope someone can point me on the right direction, thanks in advance.

<head>
  <%if Request.QueryString("enviado") = 1 then%>
    <script type="text/javascript">
    var google_conversion_id = 97885866;
    var google_conversion_language = "es";
    var google_conversion_format = "2";
    var google_conversion_color = "ffffff";
    var google_conversion_label = "BNPUCI6xqQIQ-ofj0gM";
    var google_conversion_value = 0;
    </script>
    <script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
        <img height="1" width="1" style="border-style:none;" alt="" src="http:www.googleadservices.com/pagead/conversion/978895866/?label=BNPUCI6xqQIQ-ofj0gM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>
<script language="javascript" type="text/javascript">
    window.ysm_customData = new Object();
    window.ysm_customData.conversion = "transId=,currency=,amount=";
    var ysm_accountid = "1FJ1MOC128JN2MQEDCC45EREVMC";
     document.write("<SCR" + "IPT language='JavaScript' type='text/javascript'" + "SRC=//" + "srv3.wa.marketingsolutions.yahoo.com" + "/script/ScriptServlet" + "?aid=" + ysm_accountid + ">
     </SCR" +"IPT>");
</script>
<script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount, 'UA-10880766-1']);
    _gaq.push(['_trackPageview']);
    (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var 开发者_如何学Cs = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
</script>
<%end if%>
</head>


I'm a little bit late, but maybe this helps other people as well.

When I understand this correct you are referring to the fact, that the GoogleAnalytics Tracking is fired twice. If yes, I also had a similar problem on my page. The problem however did only occur in Firefox and Chrome, but not in Internet Explorer.

This problem was in my case related to a empty src tag in my code. In Firefox and Chrome "" means "this URI" and therefore my tracking was fired twice.

I could fix that by removing the yahoo pixel in my code.

You can read also: here for more info.

0

精彩评论

暂无评论...
验证码 换一张
取 消