Enable AdSense auto ads conditionnaly in code - adsense

Is it possible to configure AdSense auto ads in the snippet code instead of enabling that in the dashboard?
What I want to achieve is to choose what types of auto ads to show for each request according to some conditions:
Anchor Ads
Anchor Ads + Wide Screen
Vignette Ads
Vignette Ads + Wide Screen
Ad load
Can I specify additional parameters in this snippet code? Where can I find the full list of available properties?
<script async src="https://pagead2.googlesyndication.com/..." crossorigin="anonymous"></script>
<script>(adsbygoogle = window.adsbygoogle || []).push({});/script>

Related

adsense multiplex ad showing only 1 ad

I add it like below:
(note that this is happens in React.js code so there is a style attribute there)
<ins className="adsbygoogle"
style={{display:"block",
"marginLeft": "auto", "marginRight": "auto"}}
data-ad-format="autorelaxed"
data-ad-client="ca-pub-xxxx"
data-matched-content-ui-type="image_stacked,image_stacked"
data-matched-content-rows-num="2,2"
data-matched-content-columns-num="2,2"
data-ad-slot="xxxx" >
</ins>
I see only 1 ad instead of 2x2. Same on both mobile and desktop, image below:
What am I doing wrong here? Any ideas why it never gives me the 4 ads like requested?

Hide Google Adsense banner when there's no advertisments on Website

I have some problems when trying to integrate Google Adsense to my Weather Website.
The google banner is running but not well. Sometimes, it doesn't show anything except for a blank banner. Like in this pic: Picture
The first problem leads me to think about hiding the banner when there's no ads loaded. I found a solution which is adding data-ad-format="auto" to the banner tag. But I need to customize the banner dimension for the mobile. If I use data-ad-format="auto", I will not be able to customize the dimensions of the banner.
Does anyone has a solution for this? Hiding the banner when there's no ads?
Thank you very much!
I have had this problem for quite a while, the first ad unit above the fold does not collapse (with collapse set within Adsense), yet the ads below the fold will collapse. I have read that it will work if you integrate it with Google Ad Manager though I haven't had time to test it yet
You can hide the element if no ads using this:
ins.adsbygoogle[data-ad-status="unfilled"] {
display: none !important;
}
or only show element if there is and ad using this:
ins.adsbygoogle a {
display: none !important;
}
ins.adsbygoogle[data-ad-status="unfilled"] a {
display: block;
}
source: https://support.google.com/adsense/answer/10762946?hl=en

Callback for Google Play Ads (android.googleAdUnitId or ios.googleAdUnitId build hints)

My CodenameOne app works perfectly when using the android.googleAdUnitId or ios.googleAdUnitId build hints in order to show the Admob Ads banner at the bottom. However, I would like to give some coins/diamonds as rewards when users click on the bottom Ads banner. How can I do this? Is it possible for the main class to handle this by implementing the AdsListener interface like the https://github.com/chen-fishbein/admobfullscreen-codenameone supports (or at least the main class should implement a special interface which has the onAdLeftApplication() function only?)
Shai, Chen, anyone, do you have any advice?
There is no way to adjust the banner behavior, if you want to reward the user use full screen ads, there are quite a few full screen ads providers with a CodenameOne integration see these:
https://github.com/chen-fishbein/flurry-codenameone , https://github.com/chen-fishbein/startapp-codenameone , https://github.com/amiga/aerserv-codenameone

Responsive code for google DFP

I am using google dfp on a responsive site.
I have called
googletag.pubads().display();
googletag.pubads().refresh();
on window resize
But it doesnt seem to work.
I have already defined different slots for mobiles and tablets, but it works on page load and not window resize.
Can someone please suggest how this can be achieved? Any links to live responsive sites using google dfp will also be helpful
Try this -
// <![CDATA[
var resizeTimer; function resizer() {
googletag.pubads().refresh([window.Leaderslot]); }
window.addEventListener("resize", function(){ clearTimeout(resizeTimer);
resizeTimer = setTimeout(resizer, 250); });
// ]]>;
Take a look here for the orginal code and explanations - http://exisweb.net/how-to-use-google-adsense-on-a-responsive-website

Facebook Application Approval

I'm developing a Facebook application.
It can be seen here:
http://apps.facebook.com/tangram-girbaud/
When the user has to aprove the application, this comes to the screen:
A Facebook logo inside the canvas, and the user does not click the logo.
If you click that logo Facebook sends you to the aproval window.
Is there any way to override this view?
Thanks.
What you need to do is to redirect using the below script:
<script type="text/javascript">
window.top.location.href = "https://www.facebook.com/dialog/permissions.request?app_id=196403870434233&display=page&next=http%3A%2F%2Fwww.pilatosapp.com%2Ftangram-girbaud%2F&response_type=code&fbconnect=1&perms=publish_stream%2Cuser_about_me%2Cuser_birthday";
</script>
from frame info, address of frame is:
https://www.facebook.com/dialog/permissions.request?app_id=196403870434233&display=page&next=http%3A%2F%2Fwww.pilatosapp.com%2Ftangram-girbaud%2F&response_type=code&fbconnect=1&perms=publish_stream%2Cuser_about_me%2Cuser_birthday
As you somehow frame facebook.com, it doesn't show the content instead facebook logo.
you may inspect further why permission dialog opens not at window.top