Archived topic
google-site-verification /google adsense verification
5 replies · Started by imke on February 20, 2017
Hello,
I need some help:
I don't succeed in verifying the google-site and google adsense.
I'm using a plugin for facebook/youtube/google+ - this works.
But the identification for google doesn't work.
Google asked me to put the following into the head/html:
<meta name="google-site-verification" content=".....number....." />
and
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "...code-number.....",
enable_page_level_ads: true
});
</script>
I wasn't sure, so I had a look in the generatepress support.
In GP-Hooks I added:
<meta name="google-site-verification" content="....number..... />
add_shortcode( 'adsense' , 'my_adsense_shortcode' );
function my_adsense_shortcode()
{
ob_start();
?>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Ad code -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client: "....code-number...."
data-ad-slot:"...number..."
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<?php
return ob_get_clean();
}
I activated php and saved the Hooks.
Then I had a look in the html-background of the website and couldn't find anything.
And I assume google doesn't find anything either.
website: view-source:http://bairisch-diatonischer-jodelwahnsinn.de/
What's wrong?
Thank you for helping!
Imke
Hi Imke,
I would recommend giving Tom's method a shot: https://generatepress.com/forums/topic/page-header-content-cannot-save/#post-221222
Let me know if this helps.
That adsense code needs to be added to your functions, not GP Hooks: https://docs.generatepress.com/article/adding-php/
Hello,
thanks for helping.
This is very complicated. There is no way just to go into html?
The next problem is to insert the google tag manager, too.
Could I manage this via ftp?
Imke
Have you tried the method Tom suggested? You should be able to simply copy and paste the code into Code Snippet (make sure it's activated).
https://docs.generatepress.com/article/adding-php/#code-snippets
Inserting the google manager tag can be done using GP Hooks in the wp_head hook.