PDA

View Full Version : Where & how to insert Google AdSense Code


alfuzzy
07-11-2018, 05:46 PM
Can some kind person please explain how & where to insert the Google AdSense code for my website running vBulletin 4.2.3 please.

I've been racking my brain trying to figure this out for days & days...but I'm not really getting anywhere.

- Google seems to say add the AdSense code to the header and/or footer files. But this seems to apply to html based websites.
- I also seem to keep seeing that I need to edit the vBulletin "postbit_legacy" template. But not really 100% sure where to add the AdSense code without messing things up.

Could really use some help,

Thanks

iA1
07-11-2018, 08:21 PM
In admincp, there is an option for advertisements. Simply select where you want to display the ads and paste the code.


See https://www.vbulletin.com/docs/html/main/advertising_ad_new for details

alfuzzy
07-11-2018, 10:05 PM
In admincp, there is an option for advertisements. Simply select where you want to display the ads and paste the code.

Thank you iA1. That seems easy enough. Just did it (followed the vBulletin manual instructions)...but no ads are appearing on my site. I only did a new add for below the NavBar at the moment.

Thanks

iA1
07-12-2018, 02:27 AM
Clear cache under Maintenance and check again. Usually it appears after some time.

alfuzzy
07-12-2018, 10:34 AM
Ok...cleared cache. Will wait a bit and see if successful:)

Thanks

alfuzzy
07-12-2018, 11:05 AM
Been about 30 minutes...unfortunately nothing has shown up yet (hopefully that's long enough).

Any other ideas/suggestions?

Here's a screenshot of my ad settings...maybe something is setup incorrectly?

- I blocked out some of the ad code...but you can see there's html ad code there (copied & pasted from advertiser).
- I believe I have it setup so that everyone see's the ad's (all usergroups).

Thanks

Dave
07-12-2018, 11:26 AM
None of the checkboxes are checked in the section at the bottom. Review those settings and check at least one, for example the user (does not) belong to usergroup setting.

alfuzzy
07-12-2018, 01:30 PM
Hey Dave...thanks for posting.

Do I really need to check at least one of the boxes in the lower half of the screen shot?

In the upper area there's the "Active" setting...with choices of "Yes" or "No". I currently have "Yes" selected. Right below that it says "If active and no criteria are set, ad will display to all."

I'm understanding this to mean that if nothing is selected in the lower half...that the ads will display to all. So I was thinking I didn't need to check any of the boxes in the lower half of the screenshot.

Thanks

iA1
07-12-2018, 01:33 PM
Are you using a custom style? Maybe ad templates are disabled in that. Check the default template. Also, do you have ad block installed?

Dave
07-12-2018, 01:35 PM
Ah good catch, yes in that case no checkboxes need to be set.

alfuzzy
07-12-2018, 01:52 PM
Ah good catch, yes in that case no checkboxes need to be set.

Thanks for confirming Dave. I'm fairly new at this...so good to have someone confirm things.

Dave
07-12-2018, 01:53 PM
You are not using an ad blocker that could cause it not to display?
Feel free to private message me your website URL so I can take a look to see if it's working or not.

alfuzzy
07-12-2018, 02:01 PM
Are you using a custom style? Maybe ad templates are disabled in that. Check the default template. Also, do you have ad block installed?

Great questions!

Yes...I normally do have an ad blocker installed...but I have it uninstalled at the moment. And I'm also using a 2nd computer (with no ad blocker)...and I'm getting the same results.

Also awesome question regarding a custom style. I do believe I'm using a custom style (not vBulletin 4 default). I went to "Styles & Templates"...then "Style Manager"...then scrolled to the settings for "Ads". Hopefully I'm in the correct area.

Attached is a screenshot of the settings. Anything look unusual?

Thanks

Dave
07-12-2018, 02:31 PM
From what I can see, you have Google Analytics properly inserted and 2 Google ad locations: below navbar and above footer.

However, the Google Ads script code is missing, which causes the ads not to display. The Google Ads actual script that loads Google Ads must be inserted in the headinclude template. (where you inserted the Google Analytics script)

alfuzzy
07-12-2018, 03:42 PM
From what I can see, you have Google Analytics properly inserted and 2 Google ad locations: below navbar and above footer.

However, the Google Ads script code is missing, which causes the ads not to display. The Google Ads actual script that loads Google Ads must be inserted in the headinclude template. (where you inserted the Google Analytics script)

When you say the Google Ads Script is missing. Are you referring to the area in the screenshot (the "Ad Manager" area)...or somewhere else totally different?

As you can see...I do have the Google Ad script code entered in the Ad Manager area.

Thanks

alfuzzy
07-12-2018, 04:13 PM
Ok...I did a search in the "Search in Templates" area...and found the "headinclude" template.

Are you saying that the same Google AdSense code that was inserted in the "Ad Manager" area...also needs to be inserted in the "headinclude" template as well?

If so...where do I insert it...without messing things up.;)

Thanks

Dave
07-12-2018, 05:08 PM
Yes, that script is not showing up on your forum. Insert it into the headinclude template and see if it then works.

alfuzzy
07-12-2018, 05:31 PM
<u>Just to be 100% sure:
</u>
- Does it matter where the code is inserted in the headinclude template? I don't want to mess things up.

- Can this html code be inserted directly into the headinclude template...without any additional PHP code?

- Is the Google AdSense code that I inserted into the Ad Manager needed in both places to work properly (Ad Manager and headinclude template areas)?

Thanks

Dave
07-12-2018, 05:34 PM
No need to worry, even if things break you can easily restore it back to how it used to work.
Just insert the Google Ads script at the bottom of the headinclude template and don't do anything else.

alfuzzy
07-12-2018, 05:43 PM
Ok...gonna give it a shot.:)

--------------- Added 1531424927 at 1531424927 ---------------

Hey hey hey...it worked!!! Yeyyy!

Thanks Super-Dave!:)

--------------- Added 1531425015 at 1531425015 ---------------

If I wanted to get more ads working on my site...what files do I need to insert the Google Adsense code into?

For example:

- footer
- header
- sub-forums
- within threads
- etc.


Thanks

--------------- Added 1531426204 at 1531426204 ---------------

As an example of where else to place ads. If I click on "Add New Ad"...I get the "Ad Selector" window. There's a drop down menu at the center top...with selection choices of (Global, Thread, Forum, Board).

If I wanted to get ads operating in these area's...do I need to add the Google AdSense code to different templates to get the ads working in these areas?

Thanks

--------------- Added 1531488833 at 1531488833 ---------------

Hey all. Dave helped me with getting my AdSense ads working in the header area of my website (mostly the home page)...still no luck getting ads working in other positions and other areas.

Would like to get adds working in the:

- Footer
- Right margin
- Other positions too.

Also would like to get adds working on other pages/areas of website subpages such as :

- sub-forum groups
- indivdual sub-forums
- individual threads

Also in the header, footer, and right margin areas.

Thanks:)