Implement AdSense Revenue Sharing on a Multi-Author Blog

Published in: Google AdSense - programming - Software Hacks

Let’s assume that you are the administrator of a team blog that has multiple guest authors.

The revenue sharing arrangement is such that all writers get to keep a fixed percentage of the actual AdSense revenue generated from articles that they have written.

This arrangement, from the perspective of team members, maybe better than dividing AdSense revenue based on pageviews because the author is getting exactly what he earned. You can have less number of pageviews but if the CPM of your niche is high, it kind of balances out.

Now to put such a thing in place, you have two options – either ask all the authors to open separate AdSense accounts and send you their ad tags or better still, you can have just use one AdSense account (your own) and create separate channels for all authors. Let’s see how:


Say your blog (hosted on WordPress or Blogger) has three authors – Sam, Peter and Matt. Go to your AdSense dashboard and create three separate custom channels – give each channel a name that matches with the name of author.

Now create three different ad units (of the same format) but assign a different channel to each of them. You can follow a naming convention like Leaderboard_Peter, Leaderboard_Sam, etc.


Get the AdSense code corresponding to the AdSense channel you just created and it will look something like this.

<script type\="text/javascript"\><!--
  google_ad_client = "pub-xyz";
  /\* Leaderboard - Peter \*/
  google_ad_slot = "123789";
  google_ad_width = 728;
  google_ad_height = 90;
<script type\="text/javascript"

The code will be exactly similar for all other ad units (per author) with one exception – the value of google_ad_slot will vary depending on the author and this is something that will help us determine the exact AdSense earnings of different authors.

To get the author name of a post on WordPress or Blogger, you can use the following code:

- _Old Classic Blogger_: <$BlogItemAuthorNickname$>
- _New Blogger_: <>
- _WordPress Blogs_: <?php get_the_author(); ?> – you may even consider suing get_the_author_login();

Now all you need to do is write a simple piece of JavaScript code that maps the author name and google_ad_slot values correctly. Here’s an example with WordPress:

<?php function get_ad_codes($author) {
 if($author == 'peter')
   return '123789';
 elseif ($author=='sam')
   return '987878';
 else // default, no author found
   return '964743';
} ?>

Now the AdSense code in your WordPress blog template will be something like this:

<script type\="text/javascript"\><!--
  google_ad_client = "pub-xyz";
  google_ad_slot = "<?php echo get_ad_codes(get_the_author());?>";
  google_ad_width = 728;
  google_ad_height = 90;
<script type\="text/javascript"

Blogger Templates support only JavaScript (no PHP) so you’ll have to slightly modify the code above to make it work with Blogger.

When the payment cycles is near, group the AdSense report by channels and there you’ve the exact earning data per author.

The upcoming AdSense reports in Analytics will tell you the earnings per URL but you’ll still need a different mechanism (like the one above) to find revenue per author.

📮  Subscribe to our Email Newsletter for Google tips and tutorials!
Published in: Google AdSense - programming - Software Hacks

Looking for something? Find here!

Meet the Author

Web Geek, Google Developer Expert
Amit Agarwal

Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India. He is the developer of Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory

Get in touch

Google Add-ons

Do more with your Gmail and GSuite account

We build bespoke solutions that use the capabilities and the features of Google Workspace for automating business processes and driving work productivity.

  1. Mail Merge with Attachments
    Send personalized email to your Google Contact with a Google Sheet and Gmail
  2. Save Emails and Attachments
    Download email messages and file attachments from Gmail to your Google Drive
  3. Google Forms Email Notifications
    Send email notifications to multiple people when a new Google Form is submitted
  4. Document Studio
    Create beautiful pixel perfect documents merging data from Google Sheets and Google Forms
  5. Creator Studio for Google Slides
    Turn your Google Slides presentations into animated GIFs and videos for uploading to YouTube