I'm writing an Electron app that I'd like to place Google ads in, but I'm not sure how to correctly do it.
I've created my ad snippet and put it in my app. The default snippet uses //googleads.g.doubleclick.net ...
as the URL for the adsbygoogle.js file, so I had to change that to https://googleads.g.doubleclick.net ...
because the Electron app uses file:///
to load the index page.
But after doing that, the adsbygoogle.js file throws up a 400 error which is strange.
And on top of that, I'm not sure how to handle a user clicking on ads. To get the link to my website working, I had to create a link that pointed to javascript:shell.openExternal('https://example.com')
, but I'm not sure how to do that with external ads.
So how can I put ads in my Electron app?
Google AdSense is not allowed in any desktop applications.
From 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With