Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > Management Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
vBulletin Google Adsense Deep Integration Tutorial
NeutralizeR
Join Date: Aug 2005
Posts: 355

 

Show Printable Version Email this Page Subscription
NeutralizeR NeutralizeR is offline 02-13-2006, 10:00 PM

This tutorial is written to show you how to use your Google Adsense codes efficiently in your vBulletin (3.5+) templates. I have a very heavily modified vBulletin style but i used the original style for this tutorial to be simple and match the colors. You can change everything as you want to find the most fitting results for your vBulletin.

Alternate ads-PSAs to Collapsible ads:

Quote:
Collapsing ad units are an optional advanced feature of alternate ads. A+ the collapsing ad unit code will 'collapse' your ad unit so that it takes up no page space if there are no relevant ads available. This allows you to minimize any blank space that would otherwise occur through the use of alternate colors.

To implement the collapsing ad units feature, you'll need to host a small HTML file on your domain. Your alternate ad URL will reference this file, which will be called if there are no ads available for that particular ad unit.
http://joomla.medspan.info/forum/index.php/topic,57.0.html

Create a HTML file with this code and save it as collapsible_ad.html:
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<script src="http://pagead2.googlesyndication.com/pagead/google_adsense_script.js" type="text/javascript"></script>
</head>
<body style="background-color: transparent;">
</body>
</html>
Upload this file to your web server. (http://www.yourwebsite.com/collapsible_ad.html)

Go to your Google Adsense account and grap your google_ad_client and google_ad_channel codes. (google_ad_channel is optional)

Open Notepad and paste these codes as you will change them with youradsensecode and yourchannelcode on the following steps.

We will use these there ad layouts in this tutorial:

728 x 90 Leaderboard
468 x 60 Banner
234 x 60 Half Banner

...and one link unit:

468 x 15

Note: navbar template editing step is optional because it may be against the Google Adsense rules for you. If you edit navbar template, almost all of your vBulletin pages will have Adsense ads at the top of the pages. My navbar and header templates include some flash, gif and text content and i update them regularly. It's why i use Adsense ads in navbar. You may apply this step (the ad unit) manually to your FORUMHOME, FORUMDISPLAY, etc templates...

Open your navbar template: vBulletin AdminCP > Styles & Templates > Edit Templates > Navigation / Breadcrumb Templates > navbar

(for the link unit)

Find:
Quote:
<div class="navbar" style="font-size:10pt"><a href="$vboptions[forumhome].php$session[sessionurl_q]" accesskey="1"><img class="inlineimg" src="$stylevar[imgdir_misc]/navbits_start.gif" alt="" border="0" /></a> <strong>$vboptions[bbtitle]</strong></div>
</if>
Add below:
Quote:
<script type="text/javascript"><!--
google_ad_client = "youradsensecode";
google_alternate_ad_url = "http://www.yourwebsite.com/collapsible_ad.html";
google_ad_width = 468;
google_ad_height = 15;
google_ad_format = "468x15_0ads_al_s";
google_ad_channel ="yourchannelcode";
google_color_border = "F5F5FF";
google_color_bg = "F5F5FF";
google_color_link = "22229C";
google_color_url = "000000";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
Results:





(for the ad unit)

Find:
Quote:
<!-- / PAGENAV POPUP -->
</if>
Add below:
Quote:
<table class="tborder" cellpadding="0" cellspacing="0" border="0" width="100%" align="center">
<tr>
<td class="alt1" align="center">
&nbsp;<script type="text/javascript"><!--
google_ad_client = "youradsensecode";
google_alternate_ad_url = "http://www.yourwebsite.com/collapsible_ad.html";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="yourchannelcode";
google_color_border = "F5F5FF";
google_color_bg = "F5F5FF";
google_color_link = "FF0000";
google_color_url = "000000";
google_color_text = "22229C";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>&nbsp;
</td>
</tr>
</table><br />
Results:




Save.



Open your FORUMDISPLAY template: vBulletin AdminCP > Styles & Templates > Edit Templates > Forum Display Templates > FORUMDISPLAY

(First thread)

Find:
Quote:
<if condition="$show['threads']">
Add below:
Quote:
<tr>
<td align="center" class="alt1">-</td>
<td align="center" class="alt2">-</td>
<td class="alt1">
<div>
<script type="text/javascript"><!--
google_ad_client = "youradsensecode";
google_alternate_ad_url = "http://www.yourwebsite.com/collapsible_ad.html";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel ="yourchannelcode";
google_color_border = "F5F5FF";
google_color_bg = "F5F5FF";
google_color_link = "22229C";
google_color_url = "000000";
google_color_text = "22229C";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
</td>

<td class="alt2 smallfont" align="center">Sponsored Links</td>

<td class="alt1" align="center">-</td>
<td class="alt2" align="center">-</td>
<if condition="$show['inlinemod']"><td class="alt1" align="center">-</td></if>

</tr>

(Last thread)

Find:
Quote:
<!-- end show threads -->
Add below:
Quote:
<tr>
<td align="center" class="alt1">-</td>
<td align="center" class="alt2">-</td>
<td class="alt1">
<div>
<script type="text/javascript"><!--
google_ad_client = "youradsensecode";
google_alternate_ad_url = "http://www.yourwebsite.com/collapsible_ad.html";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel ="yourchannelcode";
google_color_border = "F5F5FF";
google_color_bg = "F5F5FF";
google_color_link = "22229C";
google_color_url = "000000";
google_color_text = "22229C";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
</td>

<td class="alt2 smallfont" align="center">Sponsored Links</td>

<td class="alt1" align="center">-</td>
<td class="alt2" align="center">-</td>
<if condition="$show['inlinemod']"><td class="alt1" align="center">-</td></if>

</tr>
Results:




Save.

https://vborg.vbsupport.ru/showthread.php?t=102466


Open your search_results template: vBulletin AdminCP > Styles & Templates > Edit Templates > Search Templates > search_results

(First result)

Find:
Quote:
$searchbits

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">

<else />
Add below:
Quote:
<tr>
<td align="center" class="alt1">-</td>
<td align="center" class="alt2">-</td>
<td class="alt1">
<div>
<script type="text/javascript"><!--
google_ad_client = "youradsensecode";
google_alternate_ad_url = "http://www.yourwebsite.com/collapsible_ad.html";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
google_ad_channel ="yourchannelcode";
google_color_border = "F5F5FF";
google_color_bg = "F5F5FF";
google_color_link = "22229C";
google_color_url = "000000";
google_color_text = "22229C";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
</td>

<td class="alt2 smallfont" align="center">Sponsored Links</td>

<td class="alt1" align="center">-</td>
<td class="alt2" align="center">-</td>
<td class="alt1" align="center">-</td>
<if condition="$show['inlinemod']"><td class="alt1" align="center">-</td></if>

</tr>

(Last result)

Find:
Quote:
</tr>
$searchbits
Add below:
Quote:
<tr>
<td align="center" class="alt1">-</td>
<td align="center" class="alt2">-</td>
<td class="alt1">
<div>
<script type="text/javascript"><!--
google_ad_client = "youradsensecode";
google_alternate_ad_url = "http://www.yourwebsite.com/collapsible_ad.html";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
google_ad_channel ="yourchannelcode";
google_color_border = "F5F5FF";
google_color_bg = "F5F5FF";
google_color_link = "22229C";
google_color_url = "000000";
google_color_text = "22229C";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
</td>

<td class="alt2 smallfont" align="center">Sponsored Links</td>

<td class="alt1" align="center">-</td>
<td class="alt2" align="center">-</td>
<td class="alt1" align="center">-</td>
<if condition="$show['inlinemod']"><td class="alt1" align="center">-</td></if>

</tr>
Results:




Save.


Open your postbit(legacy) template: vBulletin AdminCP > Styles & Templates > Edit Templates > Postbit Templates > postbit(legacy)

(First post and last shown post)

Find:
Quote:
<!-- / message -->
Add below:
Quote:
<if condition="(($post[postcount]==1) or ($post[islastshown] and !$GLOBALS['vbulletin']->GPC['ajax']))">
<center>
<script type="text/javascript"><!--
google_ad_client = "youradsensecode";
google_alternate_ad_url = "http://www.yourwebsite.com/collapsible_ad.html";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel ="yourchannelcode";
google_color_border = "F5F5FF";
google_color_bg = "F5F5FF";
google_color_link = "FF0000";
google_color_url = "000000";
google_color_text = "22229C";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</center>
</if>
Save.
https://vborg.vbsupport.ru/showpost....30&postcount=7

Results:





vBulletin Google Adsense Deep Integration Tutorial by NeutralizeR @ www.MsXLabs.org
Reply With Quote
  #42  
Old 05-27-2006, 09:20 PM
Dan's Avatar
Dan Dan is offline
 
Join Date: Dec 2002
Location: Titusville, Florida
Posts: 1,787
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Interesting guide on placement of Adsense ads, very useful. Might even use a few of the locations you suggested Thanks
Reply With Quote
  #43  
Old 06-02-2006, 03:51 PM
obmob obmob is offline
 
Join Date: Nov 2001
Posts: 580
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

XD i was trying to click "install" button, very useful, not only for vB pages.

thanks
Reply With Quote
  #44  
Old 06-02-2006, 05:29 PM
version2's Avatar
version2 version2 is offline
 
Join Date: Feb 2003
Location: Philly
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Damn, that forum is way too annoying. Sorry, not trying to be an ass....just too busy...too much stuff moving around.
Reply With Quote
  #45  
Old 06-03-2006, 12:31 AM
NeutralizeR NeutralizeR is offline
 
Join Date: Aug 2005
Posts: 355
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by version2
Damn, that forum is way too annoying. Sorry, not trying to be an ass....just too busy...too much stuff moving around.
Thank you
Reply With Quote
  #46  
Old 06-09-2006, 12:10 PM
NeutralizeR NeutralizeR is offline
 
Join Date: Aug 2005
Posts: 355
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

RECOMMENDED

Results:


Reply With Quote
  #47  
Old 06-21-2006, 03:04 AM
BLazeD1 BLazeD1 is offline
 
Join Date: Jul 2005
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can someone post results with this please?

Thank you!
Reply With Quote
  #48  
Old 06-30-2006, 04:19 PM
webgroup webgroup is offline
 
Join Date: May 2006
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by deep_blue
I tried to edit FORUMDISPLAY template and post coes to get google ad on forum display pages but got this error

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/coolaven/public_html/forums/includes/adminfunctions_template.php(3537) : eval()'d code on line 41

Is my VB got corrupt

Same here, it happens when trying to edit the templates.
Vbulletin warns you of the error and let you choose to go back or continue anyways.
I tried in 2 forums with 3.5.4

With both FORUMDISPLAY and POSTBIT
Reply With Quote
  #49  
Old 06-30-2006, 06:54 PM
NeutralizeR NeutralizeR is offline
 
Join Date: Aug 2005
Posts: 355
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by webgroup
Same here, it happens when trying to edit the templates.
Vbulletin warns you of the error and let you choose to go back or continue anyways.
I tried in 2 forums with 3.5.4

With both FORUMDISPLAY and POSTBIT
Copy the codes to your text editor first and check for any special characters possibly added by vBulletin... and re-check your google adsense codes.

BTW, I've upgraded my forum to vb 3.6 Beta 3 and it seems this guide doesn't need to be updated.

Regards
Reply With Quote
  #50  
Old 06-30-2006, 07:17 PM
webgroup webgroup is offline
 
Join Date: May 2006
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by NeutralizeR
Copy the codes to your text editor first and check for any special characters possibly added by vBulletin... and re-check your google adsense codes.

BTW, I've upgraded my forum to vb 3.6 Beta 3 and it seems this guide doesn't need to be updated.

Regards

I'm getting the error by just pasting the initial part of the code.

Just by pasting this in the FORUMDISPLAY:
Code:
<tr>
<td align="center" class="alt1">-</td>
<td align="center" class="alt2">-</td>
<td class="alt1">
<div>
Reply With Quote
  #51  
Old 06-30-2006, 07:21 PM
NeutralizeR NeutralizeR is offline
 
Join Date: Aug 2005
Posts: 355
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

*edit*

It seems ok... Can you try editing your templates via another browser?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:17 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07517 seconds
  • Memory Usage 2,360KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (1)bbcode_html
  • (19)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (3)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete