PHP Code, Web

Free Joomla Module – Adsense Revenue Sharing

Create beautiful Joomla websites with a flexible layout from

After some deliberation, I've decided to release my revenue sharing Joomla module for Google Adsense as Open Source. So yes, you can download it and use it for free on your website. Revenue sharing is a great way to drive fresh content creation for your website, by offering authors the opportunity to receive Adsense impressions on their content.

I extended the popular Adsense Clicksafe module, to enable revenue sharing. By installing this module, you'll get the following features:

  1. Specify defaul Adsense ID
  2. Specify default channel ID
  3. Specify ad impression sharing percentage (50%, 33%, 25%, 20%, 10%)
  4. Block ads for up to 5 IP addresses
  5. Specify alternate code for bloacked ads
  6. Choose ad alignment
  7. Choose ad type
  8. Choose ad layout
  9. Specify framed pages
  10. Specify alternate ad URL
  11. Specify alternate ad color
  12. Specify up to 4 border colors
  13. Specify up to 4 background colors
  14. Specify up to 4 link colors
  15. Specify up to 4 URL colors
  16. Specify up to 4 Text colors

Tracking the Adsense/channel ID of each author is incredibly simple. Just create a contact linked to their user ID, and put the following anywhere in the Miscellaneous field:

Here's the link to download: Adsense Revenue Sharing Module for Joomla with ClickSafe IP Blocking

Let me know of any concerns or questions in the reply field below!

Create beautiful Joomla websites with a flexible layout from



  1. Hello

    Thanks for your infos. I have installed your module, with adsense code in contact datas, now understood. If you peek an eye on my website, you will see that it is joomla with phpbb equipped forum (phpbb bridge from )

    My question : what will happen in that case, how will be chosen the adsense code to be displayed within the forum ?

    And will the shared users see their adsense code displayed when visitors visit the forum and not only the joomla part of the site ??

    thanks for info

  2. I haven't configured the module for any forum software. You'd have to find a separate phpBB revenue sharing module

  3. can someone help me with codeing an adsense sharing for every autor? Someone links a page were i can find the changes. But i have no idea.

  4. Hey Butler, I have downloaded the module from your site but I cant make it work.. it only display the ads with my adsense Id… is not picking the users adsense… how do u make it work?

  5. Never Mind, my bad… was calling the wrong table… Im not using CB… Thanx…

  6. I am also experiencing the error:

    Fatal error: Call to undefined function: get_string_between() in /home/myhomepa/public_html/modules/mod_revshare.php on line 50

    It also happens infrequently, in this case approximately 1 in 20 to 1 in 25 times. There are no authors setup at the moment, but when a test author wes setup… the error occured more frequently. The error also occurs when caching is turned on or off.

    I also want to setup 100% share to the author, is it only the one entry in the xml file or is there a change in the database or another file?

  7. Just the XML file, you'd have to add another option for 100%

  8. I am absolutely new to joomla.
    Can you plz explain how to create a contact linked to their user id..
    Can the user do this on his own or should the admin do it..
    And how to configure it if site has 1000 revenue sharing posters..
    Please explain in detail as i am very new to this

  9. Can you plz explain how to create contact linked to each user..Can the user do this or should the admin do it..And how to manage say 1000 adsense revenue sharing users using this..I am absolutely new here.. So plz explain in detail..

  10. Sorry, you'll have to find a Joomla tutorial, or join the Joomla boards for the fundamental stuff

  11. Thanks for the reply about the adding of the 100%, I also think I have the value right as a divisable number of 100. 100% would have a value of 1.


  12. Any idea on this error:

    Fatal error: Call to undefined function: get_string_between() in /home/myhomepa/public_html/modules/mod_revshare.php on line 50


  13. No sure. Just make sure you've kept the function in place!

  14. Ms. Latina Renee

    Hi Justin,

    Nice plug-in. Could you elaborate more on the tracking? We can add it to the miscellaneous field, but then what?

    Is it tracked by Google? If not, what are the steps to take to see how much the author has earned?


  15. Hi Justin,

    Here is what is happenning.

    The error:
    Fatal error: Call to undefined function: get_string_between() in /home/myhomepa/public_html/modules/mod_revshare.php on line 50

    disappeara when the fix you provided above that added:
    if(!function_exists('get_string_between')) {
    to line 87
    on line 95 is removed.

    Some observations when the line 87 fix is included:
    The error only appears on pages with one adsense ad, all pages that have more than one adsense ad never display the error.
    It only seems to occur on pages with single ads and only when it is the authors revshare ad display… the default ad seems to always display ok.

  16. That is very strange behaviour. Perhaps the get_string_between function may have to be changed for regular expression matching

  17. To Ms. Latina –
    You don't see how much the author has earned, the earnings are tracked in each author's own adsense account

  18. Hi Justin,

    I am not sure how to make the change from get_string_between function to the regular expression matching that you mentioned. I was hoping that you would know how since I am sure others may encounter the same problem in the future.

    Thanks for your help.

  19. Try this, replace lines 50-55 with this, let me know if it works:

    $do = preg_match("/[adsenseid](.*)[/adsenseid]/", $gid, $matches);
    if($do) {
    $newAds = $matches['0'];
    $do2 = preg_match("/[channelid](.*)[/channelid]/", $gid, $matches2);
    if($do2) $chl = $matches2['0'];
    $altAd = true;

  20. Sorry Justin, I tried your suggestion and it didn't work.

    I have to give up on this for now and wait until maybe an update in the future or someone else can figure it out.

    Thanks though.

  21. I should let you know.

    After applying the fix, both ads did show… but an error appeared above each ad unit, here is the error.

    Warning: preg_match() [function.preg-match]: Unknown modifier 'a' in /home/myhomepa/public_html/modules/mod_revshare.php on line 50


  22. Hi,

    I would like to organize the Adsnse revenue sharing just between to accounts, independently who is the author of a the article. It should like sharing between to default accounts. Is it possible to do that with this module?

    The site is here.

  23. Justin,

    I'd like to change the revenue share to be even higher (70%), where in you file can I look to change that? thanks…

  24. No, but I'm sure you can adapt the code.

  25. @mojave – Check in the XML file, you'll see the options for the dropdown to list the different sharing percentages.

  26. I'm using the community builder version
    getting this error when its the author's turn to have his pub ID displayed:

    Warning: Invalid argument supplied for foreach() in …/public_html/components/com_content/content.php on line 2898

  27. I should note that im using the version at

  28. Justin, sorry to be dense, but do I have to change the code as well?

  29. @Laban – this component isn't designed for community builder, but I believe in the list of comments someone has modified it for that

    @Mojave – no, you only need to modify the XML file.

  30. can anyone tell me how do i install this module i did download it but i dont know how to install it 🙁

  31. I would like to know if this is a component, module or plugin

  32. I'll give you a hint – the title of this post is "Free Joomla Module…"

  33. Wow!!!! You wouldn't believe how long I have hunted for something just like this that actually works properly on any CMS. All I have to say is THANK YOU! I did have one quick question, which is can I have this automatically insert between intro text and article body?

    Thanks again for a wonderful contribution!

  34. Hi Kelby,
    thanks for the compliment. However, to do that, I think you'd need to create a mambot.

  35. Justin,

    Thanks for the great module. One question: How do I know it's working? I mean, I can see the ads on my content, and I'm earning money from adsense, but how do I know my authors' ads are rotating? Is there any way to test this?

  36. One more question: Could you post an example of how the publisher's ID should be entered?

    e.g., pub-123456789 or ca-pub-123456789 or 123456789

    I would like to let my authors know, so that they don't make a mistake.


  37. How do you create a contact linked to their user ID?

  38. Hi all–
    I know I come late to this conversation but I've just installed this mod on my new site I tried the CB version first but I couldn't get it to work for some reason or another. This version is working though and I had just a few questions. Will the mod send the clicks to the author as well as the page impressions? And does it work on all their content items? Thanks for putting the work into this. I run a few different writing sites and this really takes the rev share concept to a new level– my users don't have to place their trust in me (someone they don't know) to insure they are paid appropriately for their content. There is a certain security in placing their trust in the Google program– a name they know.
    Thanks again!!

  39. Does this work with joomla 1.5?

  40. Hi All,

    I do have same question..Will this amazing module will work with Joomla 1.5????

    Please let me know. I am hang up coz of this.
    Thanks in advance

  41. im relly so confused,
    im poor in english
    please help me
    i installed adsense revenue sharing.
    what i want to put in "Client ID"
    if want copy module for each author of site..??
    how this module identifies author with the adsense publisher id. linkin pub id & channel in contact (miscellonous field) is only for tracking or else it used for identifying the author for their pub id.
    please give guidance…

  42. Hi.
    Seems like i'm also getting the mod_revshare/mod_revshare.php on line 50 error. Looks like it shows every time the ad should show the writers ad ID.

  43. Hey Justin I have a question, when I install this module, in the Cleint ID I put my adsense id right? But where do I put the author Adsense ID? I mean there is only one Client ID table, if I choose 50% where does the other 50% go? How can I make it go to the author Adsense?

    Sorry for my bad english :X

  44. I wanted a nice Google adsense author revenue sharing module. that is not based on community builder. Also in that there should be no need of creating contacts and giving pub ud. Also I need 100% revenue sharing.
    Can anyone please design it and give me.

  45. Hello Medipills,

    Please check JomSocial Adsense extensions on It can pass 100% adsense revenue to the author.

  46. Hello Justin Cook,

    even if I am still doubting about using or not this module on my new website, I downloaded it just in case. I thought that the minimum I could do is to thank you in return, because it has to be useful for a lot of webmasters and open source spirit is something that helps a lot.

    Yours faithfully,

  47. Ubaid Web ID | Blog Pelajar Indonesia » Blog Archive » Joomla dan Google Adsense

Leave a Reply

Your email address will not be published. Required fields are marked *

To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image