1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

AdSense Revenue Sharing Idea

Discussion in 'XenForo Questions and Support' started by mrGTB, Nov 13, 2011.

  1. mrGTB

    mrGTB Well-Known Member

    After a few hours I'm getting nowhere with this idea, not sure if it can even work the way I'm thinking it can. Here goes!

    1: I wanted first to add a new custom single-line text field called "adsense".

    2: In the template called "ad_message_body" I was going to put the full Google AdSense code for a 728x90 banner, but leaving the adsense "pub-xxxxxxxxxx" section empty. Replaced with the custom field code needed to grab a users value there (if they enter a pub-xxxxx number in their profile settings) for the custom adsense field section.

    3: The whole adsense code was going to be wrapped in a conditional that would only show ads in the first post only (so just the thread starter got his advert displayed).

    Can this be done?
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Yep. Use this in ad_message_body:

    <xen:if is="{$message.position} == 0 AND {$message.customFields.adsense}">
    	ADSENSE CODE BLAH BLAH pubid={$message.customFields.adsense}
    You need to specify the field_id of the profile field (adsense).

    You should also check with Google about this. I don't use Adsense, but I suspect they might not like this idea.
    mrGTB likes this.
  3. mrGTB

    mrGTB Well-Known Member

    I've been reading since this might NOT actually be such a good idea, but I'm not 100% sure about Google's stance on this one, but they could be wrong of course. Just stuff I'm reading others saying about doing it. Shawn from Digital Point would know more because he WAS running "ads revenue sharing" at one point on his forum for members.

    I'm not writing the idea off because I think it's a good one for sure in inciting members to start threads.

    That conditional you posted there, does that hide the adsense code (the banner) if they make a first posts but don't have their PUB ID number entered. Seeing as the thread starter stands to make money with their banner ad displayed.

    Also, when you get to a "second page" (in a thread) does the first post in that also get the banner ad displayed. Is there a way also of maybe showing a banner on first and (last post) on each page, because the problem I see is you'll have people wanting to start a thread to list their banner advert, but after that they'll have little interest and neither would others if no more banners get added later after so many posts are made in it.

    Thanks for the code Jake, spent hours trying to figure this out with no joy.
  4. mrGTB

    mrGTB Well-Known Member

    This works perfect, here are some screen-shots taken while setting it up just now.

    What the custom field looks like:

    Setting up the custom field:





    Google AdSense code needed in "ad_message_body" template complete with styling class:

    CSS Class added to "EXTRA.ss" for styling class used:
    The MOZ shadow effect code can be removed, I just threw it in there to show off what can be done with adverts and styling them.

  5. mrGTB

    mrGTB Well-Known Member

    Jake, does this conditional put together look correct to you. Done to only show ads to visitors and to exclude ads from being displayed in certain forum ID's listed (like private forums).

    <xen:if is="{$message.position} == 0 AND {$message.customFields.adsense} AND !in_array({$forum.node_id}, array(1,3,5)) AND !{$visitor.user_id}">
    Obviously this is going in the "ad_message_body" template. It's appears to be working fine on testing it, just want to be sure though, or if it can be improved.

    Thinking more about this also, there's no need to change the code to show after (first and last post), you could simply do the same with the "ad_thread_view_below_messages" template to show a persons banner after last post that way using the same code grabbing a persons custom adsense profile field pub number.
  6. mrGTB

    mrGTB Well-Known Member

    Just to add to this after running some testing. :eek:

    This will only work if you use TWO (not one) custom fields added used for both AdSense "CLIENT" and "SLOT". Two things worth keeping mind also here, the person on your forum filling in these two fields must first make "double sure".

    1: They have their AdSense account set-up to show ads on any domain (otherwise they won't make a penny) from any click-thru's. Or at least have your domain listed as allowed.
    2: They (MUST) create a 728x90 banner on their account they grab the CLIENT and SLOT number from, that's if your using the same size of banner for ads revenue sharing on your site. However, the size doesn't matter as much if your not using styling wrapped around the ads.

    For example: The SLOT number dictates the size of banner they get displayed they created on their account. So if they take the SLOT number from a 468x60 banner, that's the size of banner they'll get displayed on your forum.

    The permission Jake Posted:

    Would have to look like this instead.

    <xen:hook name="ad_message_body" />
    <xen:if is="{$message.position} == 0 AND {$message.customFields.adsenseclient} AND {$message.customFields.adsenseslot}">
    <script type="text/javascript"><!--
    google_ad_client = "{$message.customFields.adsenseclient}";
    /* 728x90, created 12/11/11 */
    google_ad_slot = "{$message.customFields.adsenseslot}";
    google_ad_width = 728;
    google_ad_height = 90;
    <script type="text/javascript"
    This works after I visited another site and viewed the source code of a page there using a Google AdSense banner. I added both SLOT and Client to the Robot account on my forum bringing in RSS Feeds and saw a banner got displayed (a different sized one) using their AdSense details. So it's been tested as working.
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Yep, it all looks good.
  8. mrGTB

    mrGTB Well-Known Member

    Jake, do you know the change that's needed with the fields when doing it with the template called "ad_thread_view_below_messages". As this code below doesn't work because of the $message part in it, would changing that to: $thread.customFields.adsense work?

  9. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    This should work in your condition:

    {$firstPost.customFields.adsense} AND {$firstPost.position} == 0
    $firstPost contains the record for the first post on the page. And checking the position ensures it's only the first post on page 1. This won't work on pages 2+ because the first post in the thread is not available there.
  10. digitalpoint

    digitalpoint Well-Known Member

    I do know a little about it... I'm the one that actually originally came up with the entire concept of AdSense revenue sharing (I've never heard of anyone doing it or talking about the idea before we did it, for any type of site). May 5, 2004 to be exact... http://forums.digitalpoint.com/showthread.php?t=519

    That being said, Google is fine with it as long as you do it properly (you can't have two different AdSense IDs on the same page.. so make sure if you do it, your AdSense ID isn't on the same page as the user's). In fact Google even "borrowed" the concept a few years after we were doing it, and they do it themselves... http://code.google.com/apis/adsense/host/revenuesharing.html

    That being said... we removed it a few years ago because it was just more hassle than it was worth. You tend to attract spammers or people who think they are going to get rich by posting worthless/mindless crap on your site.

    It's not a bad gimmick for a small site to try and attract users, but it doesn't scale well to large sites when you start factoring in how much spam/stupid posts you have to deal with. By the time you are a big site, you don't need the gimmicks to attract posts anymore anyway...
  11. Carlos

    Carlos Well-Known Member

    When I saw this thread, I thought "This is a bad idea."

    Because who are you going to revenue share with? Yer users? Well, see, that's possibly a conflict. Google explains that the revenue you receive may be smaller than the profits that the advertisers get. It's in plain sight, it says "68% publisher revenue share" in Adsense. I got scared because the number would mean that the other companies gets all of your advertising dollars.

    Then I start skimming, I figure that it's the placement and strategies that you want to implement.
  12. mrGTB

    mrGTB Well-Known Member

    What you said there above, I was about to say that's not a problem seeing as only one advert gets displayed in the first posts of every page of a thread. Then I just realised I'm showing one advert in the header area that gets displayed also (making two). The single sidebar advert doesn't get displayed in threads, so that's not an issue. Does that mean the banner in the right header area (that does use my adsense banner code only), would it conflict with the one shown in the first posts of threads using members AdSense code at times. Two different banner ID's used on one page like you say.

    I know exactly what you mean by that, but some forums are excluded from showing adverts in first posts using conditionals, such as "private hidden and paid subscribers" forums. Any spam threads could be moved to a forum that in effect removes their banner with it at the same time. Such as a spam bin forum that adverts have been excluded from showing up in. Simple one click (move thread) to remove it.

    This is the new full conditional I use now, that makes sure the advert gets dislpayed on all other pages in a thread in the first posts, along with excluding members from seeing ads and letting you choose which forums can be excluded.

    <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND {$message.customFields.adsenseclient} AND {$message.customFields.adsenseslot} AND !in_array({$forum.node_id}, array(99,126,129)) AND !{$visitor.user_id}">
    It's not a revenue sharing scheme were you get 32%, the member 68%. They use their own banner PUB and SLOT number taken from a 728x90 banner advert they must create in their own AdSense account first grabbing the numbers from it. They make all money earned from their banner clicks and actually show their own banner.

    There's a big difference in that respect compared to the old idea of splitting the money made with the site owner based on percentages. This thread on my forum best explains it.

    Link: http://mrgtb.com/threads/adsense-revenue-earning-scheme.971/#post-1248

    The way I look at it, is like this. Your offering people an incentive to post, they can make money from it rather than making nothing from their posts. You can argue your making nothing from their adverts shown using this method, but if gives posters more of an incentive because of that knowing they keep everything made. Plus, your still showing adverts in other forum areas they make nothing from, along with yours getting displayed in the first posts of threads you make.
  13. digitalpoint

    digitalpoint Well-Known Member

    Yep... you need to fix that. Google does not allow a single page to show ads from multiple AdSense IDs. It could get both you and your user's AdSense account's terminated.
  14. mrGTB

    mrGTB Well-Known Member

    I'll sort that one out then ASAP, no mad rush as there's only me using ads there right now. :)

    Good to know and thanks for the heads-up on that one.
  15. Donny

    Donny Active Member

    Did you guys get this running? Did it work? Is there now a mod for it?
  16. Donny

    Donny Active Member

    I guess people gave up with this then?

Share This Page