Drupal 7 SimpleAds Module

By shane
Tue, 2012-09-11 15:43
Daily Dose of Drupal Episode #5

Share with Others

Have you ever wanted to display advertisements on your Drupal 7 website? If so, this episode will walk you through step by step, how to set up and configure text and image advertisements for display on your Drupal site using the SimpleAds Module.

In this episode you will learn:

  • How to install and configure the SimpleAds module on a Drupal 7 site
  • How SimpleAds campaigns work
  • How to display text based advertisements on your Drupal 7 website
  • How to display image based advertisements on your Drupal 7 website
  • How to view analytics and performance of the advertisements

Hello there Drupal developers and today we have another episode of the Daily Dose of Drupal, brought to you by codekarate.com. Today we are on episode number 5. Today we’re going to be covering advertisements using the Drupal 7 Simple Ads module it’s available on drupal.org and we’re going to be using the 1.8 version.

So we’re going to go ahead and jump over to our test Drupal 7 site and the first thing we’re going to do is download the Simple Ads Module. So I’m going to hop in to my command line and using Drush I’m going to download Simple Ads. I can see it contains two modules; Simple Ads module and Simple Ads Campaigns.

We’re going to hop over to our site and go into the modules page, scroll down and find Simple Ads. You can see it has Campaigns and Simple Ads, we’re going to go ahead and use Campaigns so we can show what that looks like and how that works, so I turn both those on and now we hit the Save configuration button and it is now saved.

If we scroll back down you’ll see that there are some Permissions here so if I go to the Permission’s page you can see that there are permissions for Access Advertising Campaigns, that would be for anyone needing to manage the campaign and there are also some Simple Ads permissions. Count Ad Impressions and Count Ad Clicks are important so if you wanted your authenticated users to also be counted in the advertisements you can check those, hit Save.

So the next step is going to be actually creating Campaign and a Campaign is just a grouping of Advertisements. So in this case we’re going to create a campaign for codekarate and this is going to contain a couple of different advertisements and you can select what you want to track. I’m just going to track Clicks and I’m going to say one Click is all I want this campaign to have so we can show what’s going to happen. We’re going to start now and there’s a couple of different things that you can do to select what type of date, whether you want to start tomorrow or a week from now or a specific set date.

One important thing you’re going to need to look at is the Publishing Options and actually make sure you publish this otherwise it’s not going to show up so let’s go ahead and hit Save after we checked that Publish button, now we have our Codekarate Campaign.

The next step is going to be adding a few different advertisements. I’m going to add the first one as a Text Advertisement, call this Codekarate Ad 1 and we’re going to say it’s in the Sidebar Ads. For a Text Advertisement if you wanted to track Clicks you need to use Plain Text. I’m just going to say “Check out Code Karate” and you put in the URL, we’ll go ahead and leave the Active Dates, everything at its default and now we select the campaign we want to show up on there so we could select codekarate … again here you have to make sure it’s published or it will not show up, so we save that, we’re also going to add a quick Image Advertisement, I’m not exactly sure how this is going to look, I haven’t really changed the image dimensions at all, we’ll call this Code Karate Ad 2, we’ll put this on the Sidebar Ads as the Ad group, this is the Image Ad, we’ll select Code Karate basic logo there, enter the URL, select the Campaign, the Advertisement is active and again we’ll hit Publish.

Now we have one Campaign with two Advertisements in it; let’s go ahead and take a look; if you’ll go to content you’ll have two new options up here; one for Ads List and one for Ad Campaigns. The Ads List are the Ads that you have available and it shows that it’s in the Code Karate Campaign, you can view Statistics for each Advertisement, it tells you the Clicks and Unique Clicks as well as Impressions and Unique Impressions, you can also edit and delete from that Ads List and the Ad Campaigns shows you all the Campaigns you have, how many Advertisements are in that Campaign, what the limits that you have set are and you can then view that, edit or delete it from there.

So what we’re going to do is we’re going to go ahead and add this block; there are a couple of blocks there that you can use, there’s Advertisement block for Content Ads and Advertisement block for Sidebar Ads. We’re going to add this to the first Sidebar since we added it to the Sidebar Ads group and I’m going to throw it up on top of the Sidebar, I’m going to hit Save.

Now I’m going to hop over to another browser where you can see I’m on test.codekarate.com, if I refresh you’ll see I now have an Image Ad that shows up. And when I hover over this; if you look down at the bottom you’ll see that it’s actually sending me to a link on my test.codekarate.com site and it’s going to use the Simple Ads module is going to then track that Click and redirect me to wherever I said I wanted this to go.

So if I go ahead and click here it opens up in a new window and then it brings me to the codekarate.com website. So if I refresh again I now have check out Code Karate, if I refresh a couple more times you’ll notice that I’m only getting that Text Advertisement now.

The Image Drupal advertisement is not showing up so if we hop back over here we can find out why. I’ll go into content, go into the Ads list and you’ll see that Code Karate Ad 2 which was that Image Advertisement is not published and is now inactive. And this is because we set our campaign limit at one click. After one click; any advertisement in that campaign is going to become disabled. If we hop back over and we click on the Tex Advertisement it opens up the Code Karate website again and now there are no Ads because it was then deactivated. So if we refresh here you can see that now none of these advertisements are published, you can go ahead and look at the statistics shows that there are 6 Ad Impressions, only one Unique Impression and it breaks it down into today, yesterday and a couple of different date ranges and then we only had one Click. And that’s all there really is to the Simple Ads module, at least getting us set up basically.

There’s also good integration with Views so you can modify the advertisements and what’s displayed using the Views module, you can also, using the Advertisement filter which I will show you where that is quickly. Inside the Filter the full HTML and you can add a Filter for a simple Ads Filter which will allow you to insert advertisements directly into your content.

So if you had specific pages that you wanted specific advertisements to display, you could use that filter just by turning that on and adding this little piece of code and there’s a little bit more documentation on that I believe on the Simple Ads page. So that’s it for this time, if you are interested in learning more check out the other Daily Dose of Drupal videos and be sure to follow me on Twitter @smthomas3 and check out my other posts on codekarate.com. Until next time, thanks for watching.