Adding adsense

I am trying to add google AdSense to my site, I have put the code into the advertising bit of the set up and also the code in between the head and head tags in the page container. Is there something obvious I am missing?

Google adsense is all approved.

Thank you
 
the code in between the head and head tags in the page container
There is no code to put here, except if you add AMP Ads. It is the case ?
If it's the first time you want to display adsense on your site you have to wait Adsense Bots crawls your site. It could take some hours but usually is faster thant that.
 
There is no code to put here, except if you add AMP Ads. It is the case ?
If it's the first time you want to display adsense on your site you have to wait Adsense Bots crawls your site. It could take some hours but usually is faster thant that.
Google tells you to add this code on all pages where ads might be served:

<script data-ad-client="ca-pub-xxxxxxxxxxxxxxxx" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

And then you need to ad the code for specific ad placements.

@Startingup

1. Where exactly did you place the script for the head section? Usually, the best place is in PAGE_CONTAINER before the /head tag.

2. Can you post the code you used for specific ads?

3. How long ago did you add the AdSense codes? The ads don't appear instantaneously (although blank spaces where the ad will be displayed may show up). It generally takes a few days but it can be longer.
 
This is the code, I have added it to a few adverts

<script data-ad-client="ca-pub-4048102222634449" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

I added it after the word Head in the page container, which was line 12.

<xf:include template="google_analytics" />
<script data-ad-client="ca-pub-4048102222634449" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
</head>

I only did it yesterday so maybe I am expecting too much for it to be working already? Thank you
 
Ok. but what did you add in the specific advertisement slot(s)?

ACP >> Setup >> Advertising >> Add advertisement >> HTML ?

It should look something like this:
Code:
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
     style="display:block;"
     data-ad-client="ca-pub-xxxxxxxxxxxxxxxx"
     data-ad-slot="xxxxxxxxxx"
     data-ad-format="rectangle,horizontal"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
 
Some confusion here (maybe me that is confused) Google analytics asks you to put a code in <head>

In xenforo you don't need to do the template edit if you just add the google id in settings, which does all the template stuff for you.

But that is analytics, not adsense.
 
Google tells you to add this code on all pages where ads might be served:
<script data-ad-client="ca-pub-xxxxxxxxxxxxxxxx" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
I don't do this because it's not really necessary since this code is already present in each ad code.
 
<script data-ad-client="ca-pub-xxxxxxxxxxxxxxxx" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
This code line is typical for AutoADS
I don't do this because it's not really necessary since this code is already present in each ad code.
Right. Templates should only be changed if you know exactly what you are doing or the next XF upgrade could be a disaster :)

This code line shoud goto ⇒

1.) /admin.php?advertising/add
2.) Position: Container header
3.) HTML: <script data-ad-client="ca-pub-xxxxxxxxxxxxxxxx" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

4.) Save and wait some days...
 
In the HTML slot I just copied and pasted the code as per my post above and then choose where I wanted it. Hopefully I just need to wait!
 
In the HTML slot I just copied and pasted the code as per my post above and then choose where I wanted it. Hopefully I just need to wait!
Nope. Maybe if you're using AutoAds but is so you'll regret that. Otherwise you need to add additional code in the location ads as I said above:

Code:
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
     style="display:block;"
     data-ad-client="ca-pub-xxxxxxxxxxxxxxxx"
     data-ad-slot="xxxxxxxxxx"
     data-ad-format="rectangle,horizontal"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
 
Thank you, would I just copy the code you have pasted? Honestly I don't know much about codes at all.

I'm not sure what autoads means either. I think I will give up on this for now and try another day if I can't sort out different advertising. Thank you for helping anyway.
 
Back
Top Bottom