As a blogger, it's frustrating when ads don't load properly on our platform. This issue has been reported by many users, and in this article, we'll explore the solution to fix this problem.
The Problem
I encountered this issue after switching to MaterialT Mark3 skin on my Tistory blog. Adsense ads stopped loading, and I couldn't figure out why. After digging deeper, I found that the error was caused by the adsbygoogle.push() code in my script.
The Error Message
The error message read: "adsbygoogle.push() error: No slot size for availableWidth=0 TagError". This issue occurred twice, and I suspected that there might be a problem with the ad code itself. After some research, I found that the solution was to wrap the adsbygoogle.push() code in a window.onload event.
The Solution
To fix this issue, you need to modify your script as follows:
Before:
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
After:
<script>
window.onload = function() {
(adsbygoogle = window.adsbygoogle || []).push({});
}
</script>
This code ensures that the adsbygoogle.push() code is executed only when the page has fully loaded.
The Issue with Multiple Ads
After implementing this solution, I found that only the top ad was loading correctly. The bottom ad was not showing up. After some experimentation, I realized that there was an issue with the ad code itself. To fix this, I added a push code to the script as follows:
Before:
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
After:
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
This code ensures that both the top and bottom ads are loaded correctly.
The Final Solution
To solve this issue, you can use the following script:
<script>
function Adcode() {
(adsbygoogle = window.adsbygoogle || []).push({});
}
var timeoutID;
$(function() {
timeoutID = window.setTimeout(Adcode, 1000);
})
</script>
This code uses a setTimeout function to execute the adsbygoogle.push() code after a delay of 1 second.
****, solving the issue of Adsense not loading on Tistory requires some experimentation and debugging. By modifying the script and adding the push code, you can ensure that your ads load correctly. Remember to test your code in different browsers and devices to ensure compatibility.
Related Articles