gpt4 book ai didi

javascript - Facebook 受众网络在新窗口/标签中打开广告

转载 作者:行者123 更新时间:2023-11-30 16:02:37 25 4
gpt4 key购买 nike

我已将 Facebook 受众网络广告集成到我的移动网络应用程序中。但是如果一个广告被点击然后它在同一个窗口中打开,有没有什么可以在新标签页中打开广告?下面是我从 facebook 得到的代码

<script>
window.fbAsyncInit = function() {
FB.Event.subscribe(
'ad.loaded',
function(placementId) {
console.log('Audience Network ad loaded');
document.getElementById('ad_root').style.display = 'block';
}
);
FB.Event.subscribe(
'ad.error',
function(errorCode, errorMessage, placementId) {
console.log('Audience Network error (' + errorCode + ') ' + errorMessage);
}
);
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id))
return;
js = d.createElement(s);
js.id = id;
js.src = "//connect.facebook.net/en_US/sdk/xfbml.ad.js#xfbml=1&version=v2.5&appId=XXXXXXXXXXXXXX";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-ad" data-format="native" data-nativeadid="ad_root" data-placementid="XXXXXXXXXXXXXX" data-testmode="false">
</div>
<div id="ad_root">
<a class="fbAdLink">
<div class="fbAdMedia thirdPartyMediaClass"></div>
<div class="fbAdTitle thirdPartyTitleClass"></div>
<div class="fbAdBody thirdPartyBodyClass"></div>
<div class="fbAdCallToAction thirdPartyCallToActionClass"></div>
</a>
</div>

最佳答案

您是否尝试将 target="_blank"添加到链接中?

<a class="fbAdLink" target="_blank">
<div class="fbAdMedia thirdPartyMediaClass"></div>
<div class="fbAdTitle thirdPartyTitleClass"></div>
<div class="fbAdBody thirdPartyBodyClass"></div>
<div class="fbAdCallToAction thirdPartyCallToActionClass"></div>
</a>

关于javascript - Facebook 受众网络在新窗口/标签中打开广告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37497293/

25 4 0