Tagged: ,

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #985649

    Hello,

    after reading all associated support topics I tried the following to display Google AdSense Ads:
    I put this code 1 in the end of functions.php of child theme to embed code in head section of html:

    // insert adsense
    add_action('wp_head', 'wp_head_adsense');
    function wp_head_adsense() { ?>
    	<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <script>
      (adsbygoogle = window.adsbygoogle || []).push({
        google_ad_client: "ca-pub-my-costum-numbers",
        enable_page_level_ads: true
      });
    </script>
    <?php	
    }

    I put this code 2 in normal text widget:

    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- my sitename - subname -->
    <ins class="adsbygoogle"
         style="display:inline-block;width:300px;height:1050px"
         data-ad-client="ca-pub-my-custom-numbers"
         data-ad-slot="my-costum-data"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    [wp_ad_camp_1]

    I installed tthe plugin “Insert HTML snippet” and copied code 2 in its own widget.

    I installed tthe plugin “WP Simple Adsense Insertion” and copied code 2 in its setting section. Then I published the shortcode [wp_ad_camp_1] in normal text widget.

    No success at all. Frontend keeps white. What is going wrong?

    Best regards,
    Rolf

    • This topic was modified 6 years, 4 months ago by rolf2.
    #985689

    Hey rolf2,
    I tried adding your ad script to a footer widget and found that you are getting the error:

    Failed to load resource: the server responded with a status of 403

    The 403 Forbidden error means that accessing the page or resource you were trying to reach is absolutely forbidden for some reason.
    I then also tested on my localhost and got the same error.
    Please check your Google adsence code, and the settings in your account.

    Best regards,
    Mike

    #985876

    Hi Mike,

    thank you. You’re right. Google AdSense did not approve URL because website was in developement estate.

    I will try to solve that.

    Best regards
    Rolf

    #986186

    Hi,
    Glad to hear that you have an answer to the issue.
    Unless there is anything else we can assist with on this issue, shall we close this then?

    Best regards,
    Mike

    #996646

    Hi Mike,

    yes, you can close this then.

    Thank you for perfect support.

    Best regards
    Rolf

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Can not display Google AdSense Ads’ is closed to new replies.