PDA

View Full Version : Make your adsense look like a post! With Referals, forum exclusion and more!


question?
07-23-2006, 10:00 PM
Hey,

This will let you show your add after x posts, put a referal box as a false avatar, and show a 336x280 banner.

Please note this has been made for my skin (legacy). You will have to alter this i think.


Add this at the end of your postbit template:
<!-- START ADSENSE REVENUE -->
<if condition="THIS_SCRIPT == 'showthread'AND ($post[postid] == $GLOBALS['qrlastpostid']) AND (!in_array($forum[forumid], array(2,3,32)))">

$spacer_open

<table id="post$post[postid]" class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="0" border="0" width="100%" align="center">
<tr valign="top">
<td class="alt2" width="175">

<div id="postmenu_$post[postid]">
<if condition="$show['profile']">
<a class="bigusername" href="#">Focused.ORG</a>
<else />
Focused.ORG
</if>
<br><br><script type="text/javascript"><!--
google_ad_client = "YOUR ADSENSE ID HERE!";
google_ad_width = 125;
google_ad_height = 125;
google_ad_format = "125x125_as_rimg";
google_cpa_choice = "CAAQ8OCIlAIaCP1TkEVpn_IYKITHrYMB";
google_ad_channel = "";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>

</td>
<if condition="$show['moderated']">
<td class="alt2" id="">
<else />
<td class="alt1" id="">
</if>

<if condition="$show['messageicon'] OR $post['title']">
<div class="smallfont">
<if condition="$post['title']"><strong>Sponsored links</strong></if>
</div>
<hr size="1" style="color:$stylevar[tborder_bgcolor]" />
</if>

<!-- message -->
<div id="post_message_$post[postid]">
<if condition="$show['spacer']">
</if>
<div align="left">
<script type="text/javascript"><!--
google_ad_client = "YOUR ADSENSE ID GOES HERE!";
google_ad_width = 336;
google_ad_height = 280;
google_ad_format = "336x280_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "D0DFE4";
google_color_bg = "E2ECEF";
google_color_link = "85868F";
google_color_text = "85868F";
google_color_url = "85868F";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

</div>

<if condition="$show['spacer']">

</if>

</div>
<!-- / message -->

</td>
</tr>
</table><br>
<!-- / post $post[postid] popup menu -->

<if condition="$show['spacer']">
</div>
$spacer_close
</if></if>
Let me explain how to use it:
<if condition="THIS_SCRIPT == 'showthread'AND ($post[postid] == $GLOBALS['qrlastpostid']) AND (!in_array($forum[forumid], array(2,3,32)))">

In the array() you put the forums where you don't want to show the ads.

Here (($post[postid] == $GLOBALS['qrlastpostid'])) you choose where to show it. Use $GLOBALS['qrlastpostid'] to show it at the end of all the posts, $GLOBALS['qrfirstpostid'] to show it after the first post, or you can use a number.

For the picture blocks use <img src="random.php"> to where ever random.php is. Please remember to update the settings for random.php.

I reccomend you use a table to put your ads in.

If you want to show the ads only where there is more than 1 post use:
AND ($post['postcount'] > 1)
Like this:
<if condition="THIS_SCRIPT == 'showthread'AND ($post[postid] == $GLOBALS['qrlastpostid']) AND (!in_array($forum[forumid], array(2,3,32))) AND ($post['postcount'] > 1)">

If you want it to show to guests only use:
AND (!$show[member])

So it will be like:
<if condition="THIS_SCRIPT == 'showthread'AND ($post[postid] == $GLOBALS['qrlastpostid']) AND (!in_array($forum[forumid], array(2,3,32))) AND ($post['postcount'] > 1) AND (!$show[member])">

question?
07-24-2006, 08:38 PM
Please make sure you change your adsense ID where it tells you to!

Please note: I reccomend you put it at the end. In some cases, the quick reply after the adsense code may not work.

unitedpunjab
07-24-2006, 11:12 PM
installed..working great

question?
07-25-2006, 09:08 AM
Hey,

Thanks for the install. If you want, i can give you those random picture blocks. They increase your page CTR by 30-40% i've been told.

unitedpunjab
07-25-2006, 09:55 AM
yes please,that would be great

question?
07-25-2006, 10:11 AM
Hey,

I've added them. I've only added the .gifs as those were transparent. You can add more. And remember to edit the random.php.

unitedpunjab
07-25-2006, 10:19 AM
where is random.php

unitedpunjab
07-25-2006, 10:20 AM
got it,but what to add in the above code ?

question?
07-25-2006, 10:32 AM
just use somthing like
<table align="left"><tr><td align="left"><img src="path/to/random.php"></td><td align="left">ADSENSECODE HERE</td></tr></table>

Snake
07-25-2006, 11:26 AM
Thank you, works great! :)

Thomas P
07-25-2006, 12:20 PM
Thanks, that is pretty neat :cool:

One question, I use:
<if condition="THIS_SCRIPT == 'showthread'AND ($post[postid] == $GLOBALS['qrlastpostid'])">
and noticed that if someone is logged in the adcode only shows up at the end of a thread on the last page.
If viewed as a guest, the adcode shows up on every page at the end.

Any hints why it is this way and how to change it for loggend in users, too?

Thanks,
-Tom

Thomas P
07-25-2006, 01:29 PM
Second: Is there any way to show that adcode only if there is more than one post in a thread?

/update: Got it, just changed the conditional to

<if condition="THIS_SCRIPT == 'showthread' AND ($post[postid] == $GLOBALS['qrlastpostid']) AND ($post['postcount'] > 1)">which works great.

So just the one question is still open, see a.m.: https://vborg.vbsupport.ru/showpost.php?p=1037174&postcount=11

Thanks,
-Tom

question?
07-25-2006, 02:00 PM
Second: Is there any way to show that adcode only if there is more than one post in a thread?

/update: Got it, just changed the conditional to

<if condition="THIS_SCRIPT == 'showthread' AND ($post[postid] == $GLOBALS['qrlastpostid']) AND ($post['postcount'] > 1)">which works great.

So just the one question is still open, see a.m.: https://vborg.vbsupport.ru/showpost.php?p=1037174&postcount=11

Thanks,
-Tom
Thanks for that :) I will add it to thet update.

I signed up to your forum, and it shows at the end of every page. Not just at the end of threads. As guest it worked the same as well :)

Kaleem
07-25-2006, 04:12 PM
ritenow u have this in array array(2,3,32) so it means in forums 2,3,32 ads will not show rite ?

after saving got this

Parse error: syntax error, unexpected T_VARIABLE in /home/.******/****/friendskorner.com/forum/includes/adminfunctions_template.php(3537) : eval()'d code on line 249

Thomas P
07-25-2006, 06:57 PM
I signed up to your forum, and it shows at the end of every page. Not just at the end of threads. As guest it worked the same as well :)

Thanks for taking the time to test this :up:

This is very confusing. The adcode shows up when using a test user account (normal member).
But using my account it only shows up at the very end of a thread?? :confused:

What is different on my account?

icemanic
07-25-2006, 08:10 PM
how do you show this to only certain usergroups as well ? i want to only show for guests and for regular registered members, but not for a certain usergroup

question?
07-25-2006, 08:55 PM
Thanks for taking the time to test this :up:

This is very confusing. The adcode shows up when using a test user account (normal member).
But using my account it only shows up at the very end of a thread?? :confused:

What is different on my account?
Hmm, i'm not sure why. It may be a version difference or somthing. you shouldn't worry tho, it's getting to the other people in your forum.

how do you show this to only certain usergroups as well ? i want to only show for guests and for regular registered members, but not for a certain usergroupAND (!$show[member])

ritenow u have this in array array(2,3,32) so it means in forums 2,3,32 ads will not show rite ?

after saving got this

Parse error: syntax error, unexpected T_VARIABLE in /home/.******/****/friendskorner.com/forum/includes/adminfunctions_template.php(3537) : eval()'d code on line 249

If you see, that's not the file for the addon thing. And yes, you are right, forums 2,3,32 will not show the ads.

Rich
07-25-2006, 09:23 PM
Unless I am mistaken, this modification would violate Googles TOS.

question?
07-25-2006, 09:32 PM
Unless I am mistaken, this modification would violate Googles TOS.
How would it violate google's TOS?

FocusTom
07-26-2006, 01:10 AM
I do not see how this modification could possibly violate the policies set by Google's TOS. This mod does not go over the amount of ad units which are allowed as per their guidelines.

The only constraint is that the site must have content, which evidently it will as it is a forum. Please explain why you think it would violate the policies.

icemanic
07-26-2006, 02:06 AM
if i stick a number like

<if condition="THIS_SCRIPT == 'showthread'AND ($post[postid] == 5) AND (!in_array($forum[forumid], array(2,3,32)))">

will it show the ads after every 5 posts?? if not, how do i make it do that? repetetive

icemanic
07-26-2006, 02:41 AM
i have lots of forum areas, is there a way to do this so i can only show it to one forum area without listing all the other forum ids in the array?

question?
07-26-2006, 06:21 AM
i have lots of forum areas, is there a way to do this so i can only show it to one forum area without listing all the other forum ids in the array?
Yeh.

<if condition="THIS_SCRIPT == 'showthread'AND ($post[postid] == 5) AND (in_array($forum[forumid] == forumid))">

if i stick a number like

<if condition="THIS_SCRIPT == 'showthread'AND ($post[postid] == 5) AND (!in_array($forum[forumid], array(2,3,32)))">

will it show the ads after every 5 posts?? if not, how do i make it do that? repetetive
How many posts do you show per page? You would have to put it manually as an array like the forum id, without the !.

Remember google only allow 3 ads, so you might as well do it manually.

icemanic
07-26-2006, 06:29 AM
AND ($post[postcount] % 4 == 0)

using this code will do what i want, show the ads after every 4 posts
, which should not be used for adsense , i might add because of TOS i believe

question?
07-26-2006, 06:32 AM
AND ($post[postcount] % 4 == 0)

using this code will do what i want, show the ads after every 4 posts
, which should not be used for adsense , i might add because of TOS i believe
You can use it, as long as theres not more than 3 ads per page.

GrendelKhan{TSU
07-26-2006, 07:40 AM
How would it violate google's TOS?

actually it USED to (related to dynamically created pages). but Google has softened their policies...seems fine now:

Google Ad Placement (https://www.google.com/adsense/policies)

Up to three ad units may be displayed on each Web site page.
A maximum of two Google AdSense for search boxes may be placed on a page.
A single link unit may be placed on each Web site page, in addition to the ad units and search boxes specified above. Link units are considered to be 'Google ads' for purposes of these program policies.
A single referral button per product may be placed on a page up to a maximum of 4 buttons, in addition to the ad units, search boxes, and link units specified above. Referral buttons are considered to be ?Google ads? for purposes of these program policies.
No Google ad may be placed on any non-content-based pages.
No Google ad or Google search box may be displayed on any domain parking websites, pop-ups, pop-unders, or in any email.
No Google ad may be placed on pages published specifically for the purpose of showing ads, whether or not the page content is relevant.
Elements on a page must not obscure any portion of the ads, and the ad colors must be such that any ad elements, including text and URL, are visible.
Clicks on Google ads must not result in a new browser window being launched.

Dumi
07-26-2006, 08:11 AM
Is there anyway to have this code show like ever 3rd post or something like that. Awesome code, this has been the only adsense code ive gotten to work.

Nick

Thomas P
07-26-2006, 08:51 AM
@Dumi: add this to the line beginning with <if condition="THIS_SCRIPT == 'showthread' :

AND ($post[postcount] % 3 == 0)

@question?:
I think I got it, all users who don't see the adcode have to delete their cookies once, after that the adcode shows up.

/edit: I guess I'm going for this option here: http://www.vbulletin.com/forum/showpost.php?p=860782&postcount=3

question?
07-28-2006, 11:34 AM
@Dumi: add this to the line beginning with <if condition="THIS_SCRIPT == 'showthread' :

AND ($post[postcount] % 3 == 0)

@question?:
I think I got it, all users who don't see the adcode have to delete their cookies once, after that the adcode shows up.

/edit: I guess I'm going for this option here: http://www.vbulletin.com/forum/showpost.php?p=860782&postcount=3
Why do all the users have to delete their cookies?

ldma
07-31-2006, 03:46 AM
How can I get it to show ads after the first post on every page of my thread, not just the first page like at present?

question?
07-31-2006, 12:45 PM
It should already do that.

ryans
08-02-2006, 06:01 PM
how can we have it show as the 2nd post on all pages?

dacho
08-02-2006, 07:58 PM
question? you can help me please ?
it's not working for me

if you can geav me the code to do a copy
i work with postbit

after 4 post
in all the forums

ldma
08-10-2006, 02:49 AM
Does this code work on 3.6? Before I go charging into things......

tweakmonkey
08-24-2006, 11:19 AM
Great mod, quick to install and works flawlessly.

question?
10-01-2006, 05:53 PM
Does this code work on 3.6? Before I go charging into things......
I'll check now. I'm going to try it.

gunitman247
10-03-2006, 05:52 PM
Hi awesome hack. it is showing up after the last post on every page. is there a way i can make it after the first post?

newmomsforum
10-05-2006, 09:58 AM
Hi awesome hack. it is showing up after the last post on every page. is there a way i can make it after the first post?

In the instructions mate:

Here (($post[postid] == $GLOBALS['qrlastpostid'])) you choose where to show it. Use $GLOBALS['qrlastpostid'] to show it at the end of all the posts, $GLOBALS['qrfirstpostid'] to show it after the first post, or you can use a number.

gunitman247
10-09-2006, 01:42 PM
In the instructions mate:
Ya dont i feel like a blub i saw it after awhile. anywho is there any way i can make this work with YPN?

gunitman247
10-12-2006, 01:24 AM
anywho will this work with YPN?

question?
10-19-2006, 06:29 AM
anywho will this work with YPN?
Yeh. Replace the Adsense code with YPN.

RealitYYY
03-27-2007, 02:49 AM
Weve setup the 728 90 ads with this hack so it looks like a post. Is it possible to set it up with the pictures also. Could somebody give a bit more details about setting up the pictures. Was reading this and didnt quite follow it...
For the picture blocks use <img src="random.php"> to where ever random.php is. Please remember to update the settings for random.php.

flup
05-14-2007, 09:40 PM
Very nice, thanks for this!

flup
05-14-2007, 09:46 PM
If the client ID is not working, will the adds not show up? Cause I installed this mod now, but they wont show up.

Im not sure wether it's because there still is 'YOUR ADSENSE CLIENT ID HERE!!' or because I made a mistake with installing the mod.

d8tabyte
05-19-2007, 03:31 PM
you are supposed to change it to YOUR id.

Big_J
05-22-2007, 04:38 PM
anyway to use different refferal button when setting this up to show after every 3rd post. So that each would have a different refferal product?

Also is there a way to make this the sam width as the rest of the posts on the board?

Thanks

DeeperImage
05-23-2007, 12:47 PM
This is a great hack but it would be nice if someone created a pluggin with auto templates. I may install later. Very nice.

ar2
06-20-2007, 12:27 PM
Hi

What code do I need to put to show adsense only for specified usergroups?

carlosacgj
10-14-2007, 04:55 PM
Hi

What code do I need to put to show adsense only for specified usergroups?


<if condition="is_member_of($bbuserinfo, 1,2,3,4)">



1,2,3,4 ---> groups that you show your ads

Silmarillion
06-17-2010, 10:58 AM
Is this hack available for 3.8.X?

g00gl3r
11-21-2012, 02:21 PM
Is there a version of this for VB4?