【问题标题】:How to place Google adsense in Meteor.js app?如何在 Meteor.js 应用中放置 Google Adsense?
【发布时间】:2015-11-18 13:01:41
【问题描述】:

没有广告出现?我不知道为什么。

myAds.html

<template name="myAds">
   <div class="ads"></div>
</template>

myAds.js

Template.myAds.onRendered = function() {  
  $.getScript("//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js", function() {
    var ads, adsbygoogle;
    ads = '<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-ca-pub-7023*********1" data-ad-slot="58*****42" data-ad-format="auto"></ins>';
    $('.ads').html(ads);
    return (adsbygoogle = window.adsbygoogle || []).push({});
  });
};

路由器.js

Router.map( function () {
  this.route('MyRoute', {
    waitOn: function() {
      return IRLibLoader.load("//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js");
    }
  });
});

ShowAdHere.html

{{ > myAds }}

【问题讨论】:

  • 控制台上可能有任何错误?

标签: meteor iron-router adsense


【解决方案1】:
   <head>
    "<script async src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>"
   </head>

你添加了吗?

【讨论】:

  • 将其添加到 myAds.html - 没有。试过 ShowAdHere.html - 什么都没有。
猜你喜欢
  • 1970-01-01
  • 2015-12-22
  • 1970-01-01
  • 2010-10-07
  • 2019-04-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-10-15
相关资源
最近更新 更多