3

您好,我想通过标准事件实现我的 Bing 转换代码。

什么是最好的方法来做到这一点。我已经研究过,必应仅将转换代码放在正在跟踪的“谢谢”/结果页面上。我想跟踪没有感谢页面的提交。

我是否需要使用绑定函数或 ajax 与 javascript 来充当转换页面的虚拟访问者?

<script type="text/javascript"> if (!window.mstag) mstag = {loadTag : function(){},time : (new Date()).getTime()};</script> <script id="mstag_tops" type="text/javascript" src="//flex.atdmt.com/mstag/site/adf15577-4e29-4422-a6a6-371877293cb3/mstag.js"></script> <script type="text/javascript"> mstag.loadTag("analytics", {dedup:"1",domainId:"1794519",type:"1",revenue:"15",actionid:"77282"})</script> <noscript> <iframe src="//flex.atdmt.com/mstag/tag/adf15577-4e29-4422-a6a6-371877293cb3/analytics.html?dedup=1&domainId=1794519&type=1&revenue=15&actionid=77282" frameborder="0" scrolling="no" width="1" height="1" style="visibility:hidden;display:none"> </iframe> </noscript>

这是我想通过 onsubmit 事件激活的转换代码。

4

2 回答 2

0
<script type="text/javascript">

function bang() {

    var s1 = document.createElement("script");
    s1.type = "text/javascript"
    s1.text = "if(!window.mstag) mstag = {loadTag : function(){},time : (new Date()).getTime()};";
    document.body.appendChild(s1);

    var s2 = document.createElement("script");
    s2.type = "text/javascript"
    s2.src = "//flex.atdmt.com/mstag/site/sdfsfsdf-5555-49bb-9a12-a8d0d341d336/mstag.js";
    document.body.appendChild(s2);

    var s3 = document.createElement("script");
    s3.type = "text/javascript"
    s3.text = 'mstag.loadTag("analytics", {dedup:"1",domainId:"1130798",type:"1",actionid:"21354"})';
    document.body.appendChild(s3);

    var ns = document.createElement("noscript");
    var iframe = document.createElement("iframe");
    iiframe.src = "//flex.atdmt.com/mstag/tag/sdfsfsdf-5555-49bb-9a12-a8d0d341d336/analytics.html?dedup=1&domainId=1130798&type=1&actionid=21354";
    iframe.frameborder = "0";
    iframe.scrolling = "no";
    iframe.width = "1";
    iframe.height = "1";
    iframe.style.visibility = "hidden";
    iframe.style.display = "none";
    ns.appendChild(iframe);
    document.body.appendChild(ns);

    return true;
}

然后

 onsubmit="return bang();"
于 2012-09-17T17:31:28.890 回答
0

您需要做的就是将iframefrom附加noscript到您的body标签上click。我用jquery做到了:

$('<iframe src="//flex.msn.com/mstag/tag/9cad6bfb-f783-447e-810c-0f9f1a0ae968/analytics.html?dedup=1&domainId=[12345]&type=1&actionid=[12345]" frameborder="0" scrolling="no" width="1" height="1" style="visibility:hidden;display:none">').appendTo("body");
于 2014-03-28T20:36:54.560 回答