Google Electron 中的广告?

Google Ads in Electron?

我正在编写一个 Electron 应用程序,我想在其中放置 Google 广告,但我不确定如何正确地进行。

我已经创建了我的广告片段并将其放入我的应用程序中。默认片段使用 //googleads.g.doubleclick.net ... 作为 adsbygoogle.js 文件的 URL,所以我不得不将其更改为 https://googleads.g.doubleclick.net ... 因为 Electron 应用程序使用 file:/// 加载索引页。

但是在这样做之后,adsbygoogle.js 文件抛出了一个奇怪的 400 错误。

除此之外,我不确定如何处理用户点击广告。为了让 link 到我的网站正常工作,我必须创建一个指向 javascript:shell.openExternal('https://example.com') 的 link,但我不确定如何使用外部广告来做到这一点。

那么如何在我的 Electron 应用程序中投放广告?

Google AdSense 不允许在任何桌面应用程序中使用。

来自AdSense policy

Google ads, search boxes or search results may not be:

  • Integrated into a software application of any kind, including toolbars.
  • Displayed in pop-ups or pop-unders.
  • Placed in emails, email programs, or chat programs.
  • Obscured by elements on a page.
  • Placed on any non-content-based page. (Does not apply to AdSense for search or mobile AdSense for search.)
  • Placed on pages published specifically for the purpose of showing ads.
  • Placed on pages whose content or URL could confuse users into thinking it is associated with Google due to the misuse of logos,
    trademarks or other brand features.
  • Placed on, within or alongside other Google products or services in a manner that violates the policies of that product or service.

我不确定 Electron,但 Node Webkit(非常相似的技术)允许从任何给定的 url 创建应用程序。

因此,您实际上可以在网络上托管您的应用程序(上面有 运行 AdSense 广告)并为 Node Webkit 应用程序创建安装包。

安装后,它将只是普通浏览器,默认显示您的网络应用程序(使用 AdSense)。

无法(恕我直言)Google 从您的站点下载不同的 Chromium 浏览器或 Download.com 从 google.com 下载的同一个 Chromium 浏览器。

我想你可以做一些 Iframe html 标签并显示你的网站和其中的广告! 但我不知道这是否算作一个视图。