Tutorials

How to Share Adsense Revenue WordPress

This is a pretty frequent issue faced by WordPress websites where multiple authors put in their efforts. There are two ways you can keep a track of the earnings of different authors. 1. Each author can register an account on Google Adsense and copy their ad codes in the articles they contribute to the WordPress website, thus getting paid by Google according to the exploits of their articles. 2. There is no individual account hassle and the website admin registers the website with a single Google Adsense account. Based on the Google Adsense channel reports, multiple authors get paid according to their earned revenues. This tutorial tells you how you go about doing the simpler method, that\’s the latter one.

A single Adsense account lets you maintain uniformity in terms of the displayed ads on the blog and the layout of these ads. Of course, the channel reports let you analyze as to which authors earn the most. You begin by creating a new ad unit in your Google Adsense account and assigning channel X to it, where X implies the first of the two authors, the other one being Y. Paste the ad code in Notepad. Assuming a 336×280 ad, the code will be:-

<script type=”text/javascript”><!–
google_ad_client = “pub-AAA”;
/* Ad unit name */
google_ad_slot = “111″;
google_ad_width = 336;
google_ad_height = 280;
//–>
</script>
<script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>

Then, create the same ad unit again, but assign a channel Y to this unit, keeping the name of the ad similar as earlier. In this manner, you have two identical ads differing just on the Google ad slot. The image shows codes for a case with three authors, X, Y and Z.

to Share Adsense Revenue WordPress

Paste the Google ad slot numbers in Notepad. Now, assuming that you want to display the 1st ad unit on author X\’s posts and so on, assign numbers such as 111, 222 and so on respectively to the authors. Your notepad file would then have information pretty similar to as shown.

to Share Adsense Revenue WordPress

 

 

Now, open the functions.php file and add this snippet of code.

function adsense_sharing($author) {
if($author == ‘author1′)
return ’111′;
elseif ($author == ‘author2′)
return ’222′;
else
return ’333′;
}

Next, open the single.pp file and paste this code snippet where you wish the ad unit to emerge to complete the process.

<script type=”text/javascript”><!–
google_ad_client = “pub-AAA”;
/* Ad unit name */
google_ad_slot = “<?php echo adsense_code(get_the_author());?>”;
google_ad_width = 336;
google_ad_height = 280;
//–>
</script>
<script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>

Leave a Comment

4 − 3 =

Hurry Up !!!

BIG Discounts &
Great Savings on

Popular WordPress Themes of Top Developers
GET IT NOW
* Terms & Conditions Apply
close-link