I need to use javascript functions to track conversion for Bing / Adwords ppc campaigns.
For Adwords, I used the function trackConv that I found here and it works perfectly well.
The idea of the Adwords function is to use what is inside noscript to create a function and then call it to fire the tag.
I try to use the same method to create my function for Bing but it doesn't seem to work.
The Bing tag is :
<script type="text/javascript"> if (!window.mstag) mstag = {loadTag : function(){},time : (new Date()).getTime()};</script>
<script id="mstag_tops" type="text/javascript" src="//flex.msn.com/mstag/site/757f0b74-1656-4b6c-9674-a9c8af2a87ce/mstag.js"></script>
<script type="text/javascript"> mstag.loadTag("analytics", {dedup:"1",domainId:"0123456",type:"1",actionid:"543210"})</script>
<noscript> <iframe src="//flex.msn.com/mstag/tag/757f0b74-1656-4b6c-9674-a9c8af2a87ce/analytics.html?dedup=1&domainId=0123456&type=1&actionid=543210" frameborder="0" scrolling="no" width="1" height="1" style="visibility:hidden;display:none"> </iframe> </noscript>
The function :
function trackConvBing(bing_domain_id, bing_action_id) {
var iframe = document.createElement('iframe');
iframe.src = "//flex.msn.com/mstag/tag/757f0b74-1656-4b6c-9674-a9c8af2a87ce/analytics.html?dedup=1&domainId=" + bing_domain_id + "&type=1&actionid=" + bing_action_id;
iframe.frameBorder="0";
iframe.scrolling="no";
iframe.width="1";
iframe.height="1";
iframe.style="visibility:hidden;display:none";
}
And to call the function
trackConvBing(0123456, 543210)
Any idea of what the problem could be?