Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #736088

    Hi

    I would like to connect google adsense with my site and I think I add it to the theme header php file? The code is

    <script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({
    google_ad_client: “ca-pub-1483620619655473”,
    enable_page_level_ads: true
    });
    </script>

    Is the any where in particular I should add it to the file please.

    Thanks

    #737620

    Hi info224!

    Thank you for using Enfold.

    Please add this snippet in the functions.php file.

    // 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-1483620619655473",
    		enable_page_level_ads: true
    		});
    	</script>
    <?php	
    }

    Or install this plugin. https://wordpress.org/plugins/google-publisher/

    Best regards,
    Ismael

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.