Google AdSense

From PhpCOIN Documentation

Jump to: navigation, search

Google AdSense is a pay-per-view/click system that allows a webmaster to earn income from their website. phpCOIN v1.3.1 and lower can easily be tweaked to display a vertical ad tower within a side-menu block, while phpCOIN v1.4.0 directly supports Google AdSense vertical and horizontal ads within side-menu boxes, siteinfo, pages and FAQ.


phpCOIN v1.3.1 and Lower

1: Open coin_includes/custom.php so you can add a function to display adsense code. Or even better, use a custom over-ride file. Add a new function to return your AdSense code as shown below:

function do_google() {

// Only display Adsense on a content page
IF ($_GPV['mod'] == 'siteinfo' || $_GPV['mod'] == 'downloads' ||
$_GPV['mod'] == 'pages' || (!isset($_GPV['mod']) && !isset($_GPV['cp']))) {
   $_out = '(PLACE YOUR GOOGLE ADSENSE CODE HERE)';

} ELSE {
// This is the contact page, or login page, or an admin CP, etc.
   $_out = 'No ads available today';
}

return $_out;
}

2: In the Admin menu, add a menu block to display the ads. The block title should be "Sponsored Links" or something similar in keeping with the Google EULA.

3: Add a Menu Block Item to the menu block you created above:

Block ID: (from step 2)
Item ID: (sort order for this item in the block)
Text: _google
URL: n/a
Target: _blank
Type: Function
Status: ON
Admin Item: No
User Item: No

Note the leading underscore for the Text because the leading do has been dropped

4: If you wish to have more than one AdSense display per page, you can either add more than one menu-block-item by repeating step 4, or you may create multiple menu-blocks with one menu-block-item each by repeating steps 3 and 4.

5: Refresh a page that is not the home page (unless you switched your homepage to 3-columns in Admin -> Components -> index) and the ads should show up in whichever column you set the menu-blocks to appear

Please Note: This is just to get you started on adding the Google AdSense code into your site and may not adhere to all of the Google policies contained within their EULA. It is up to you to ensure that your AdSense code display is in compliance with Google EULA, so you may need to modify the code sample above.


phpCOIN v1.4.0 and higher

phpCOIN v1.4.0 has support for Google AdSense built-in. You can display a vertical or horizontal Google AdSense within a side-menu block or within a siteinfo or pages or FAQ.

The first thing to do is edit config.php and replace the $_CCFG['ADSENSE_VERTICAL'] and the $_CCFG['ADSENSE_HORIZONTAL'] values with your AdSense code. If you create these variables and values with a config_override.php file, you will never lose your AdSense code when you upgrade to future versions of phpCOIN.

There are no functions to create, so your website is now AdSense-ready.

To display a horizontal ad within a FAQ or pages or siteinfo, simply insert the tag %GOOGLE_H% wherever you want the ad to appear. To display a vertical tower ad, simply use the %GOOGLE_V% tag wherever you want the ad to appear. Note that these two tags will only work within the body of the module, ~ ie: within the big block you edit in Admin -> Parameters -> xxxxx, so adding the tag to a theme so it will appear in the site header (for instance) will not work.

To display a google ad within a side-menu box, add a menu block item:

Block ID: (which block do you want the ad to appear in?)
Item ID: (sort order for this item in the block)
Text: _display_google_adsense
URL: v OR h ~ depending on whether you want a horizontal or vertical ad
Target: _blank
Type: Function
Status: ON
Admin Item: No
User Item: No

Notice the leading underscore for the function name!

phpCOIN will allow Google AdSense ads to display only for "content" pages, as per Google EULA. Using the AdSense support built-in to phpCOIN, AdSense ads will NOT display for login, "contact us" and similar non-content pages.

Personal tools

Inscrita el Registro Mercantil de Mallorca Tomo 2140, Hoja No. PM-51034, Folio 135
This website owned and operated by: Technology Services RPVW S.L. CIF# B57345084
Avda Constitucion 48 Bajos Alaro 07340 Baleares SPAIN
Tel:+34 971518362    Fax: +34 971518368    eMail: support@phpcoin.com