How to Integrate Google Adsense in Your Elgg Site

Written by Rodolfo Hernandez Sunday, 9 January 2011

This article will give you  a step by step guide on how to put Google ads on your Elgg Community site. Before we begin, please sign up for a Google Adsense account.

Google Adsense is a great tool to display ads on your site and make money out of them. Today I will show you how to put them on a profile page and also on the Elgg Dashboard.

Profiles:

The screenshot above is a profile without ads. To put ads on every profile page, follow these steps:

1. Go to YourElggFolder/views/default/canvas/layouts. Locate and open the file widgets.php.

2. Look for this chunk of code:

3. Go to Google Adsense and create an Ad. The size recommended for an ad in the profile is 300×250. After you create an ad, it will give you a code. Copy and paste that code below the widgets_right div tag, like this:

4. Save the changes. Refresh the profile page and ads will be at the left side of the profile description:

That’s for the profile area. Now, we move on to the Dashboard area.

Dashboard Area:

The picture above is a screenshot of the dashboard without ads.  To put ads where the picture indicates, please follow these steps:

1. Go to YourElggFolder/mod/riverdashboard/views/default/riverdashboard. Locate and open the file newestmembers.php.

2. Find the div class clearfloat:

3. Go to Google Adsense and create another Ad. The size of this one is going to be 160×600. After you create the ad, it will give you a code. Copy and paste that code below the clearfloat class, like this:

4. Save the changes and refresh the dashboard. The ad should appear like this:

And that’s it.

For more info about Elgg hosting solutions please visit Arvixe-Elgg Hosting

Happy Hosting!

Rodolfo Hernandez



4 Comments

  1. pinoy chat   |  Sunday, 06 March 2011 at 10:52 pm

    it really works for my website. thanks a lot buddy. i was using spotlight and header before this.

  2. virgilio   |  Wednesday, 16 January 2013 at 7:00 pm

    Hello, I have elgg 1.8 and i cant find YourElggFolder/views/default/canvas/layouts
    thanks

  3. Rodolfo Hernandez   |  Thursday, 17 January 2013 at 9:01 am

    “YourElggFolder” is the folder where elgg is installed.

    For instance:

    public_html/views/default/canvas/layouts

  4. virgilio   |  Thursday, 17 January 2013 at 5:34 pm

    Hi
    I cant see canvas nor widgets.php. maybe bc is elgg 1.8?
    I can only go to
    public_html/mysite/views/default/widgets
    but then i see
    admin_welcome
    content_stats
    control panel, friend, new users, online users, and river
    THANKS

Leave a Reply






− 1 = six