I promised earlier that I would share this with everyone. I hope you all find it useful!
This idea was developed based on Subvert Marketing’s blog entry on the same subject, found here:
http://subvert.ca/blog/archive/expressionengine-advertising/
Thank you, Subvert!
My method takes Subvert’s method a little further, with the following enhancements:
1. No need to add PHP code to your pages
2. The ability to add to your rotation banners that are called up through Javascript and other code, such as Google adsense or Commission Junction links, etc.
So, here’s what you do:
1. Create a new set of custom fields.
Field name: banner-type
Field label: Banner type
Field type: Drop-down
Dropdown options: image | HTML
Default text formatting: None / Hide formatting menu
Field name: banner-artwork
Field label: Banner Artwork
Field type: Text
Default text formatting: None / Hide formatting menu
Field name: banner-width
Field label: Banner width
Field type: Text
Default text formatting: None / Hide formatting menu
Field name: banner-height
Field label: Banner height
Field type: Text
Default text formatting: None / Hide formatting menu
Field name: banner-link
Field label: Banner link
Field type: Text
Default text formatting: None / Hide formatting menu
Field name: banner-target
Field label: Target
Field type: Drop-down
Dropdown options: _blank | _top
Default text formatting: None / Hide formatting menu
Field name: banner-html
Field label: HTML (if no image)
Field type: textarea
Default text formatting: None / Hide formatting menu
Field name: banner-rank
Field label: Banner rank
Field type: Drop-down
Dropdown options: 1|2|3|4|5
Default text formatting: None / Hide formatting menu
2. Create a new category group.
I created one called Advertising. Create a category for each location where banners will be placed on your page. Examples: right sidebar | header | footer
When you view the list of categories in the Add/Edit Categories screen, you’ll see that each one has been assigned a number (in the far left column). Make a note of these numbers.
3. Create a new Weblog.
I created one called Advertising. Associate it with the custom field and category groups created in #1 and #2 above. Also, in the Weblog Posting Preferences, make sure “Automatically turn URLs and email addresses into links?” is set to “No.”
4. Set up a file upload location
(This one is recommended by Subvert, but may be optional as you’ll see later on)
Go to Admin > Weblog Administration > File Upload Preferences. Click the Create New Upload Destination button and fill out the form as follows. Depending on how your hosting server is configured, modify the contents of the Server Path to Upload Directory field. You’ll also need to log into your FTP account and add a new directory titled advertising. When there, change the permissions for this new directory to 777 in order to permit system uploads.
5. Obtain Google Analytics javascript code
This is how you’ll be able to track click-thrus for your advertisers. You’ll need to have a free Google Analytics account set up and ready to use. Log into your account, choose a website and copy the New Tracking Code (ga.js) from under Profile Settings > Tracking Code.
6. Add Google Analytics javascript code to template
Go to Templates and choose the template(s) where you’d like to place advertising.
At the top of your template, paste the Google Analytics code directly after the opening body tag. This is different from what Google recommends for their standard configuration, but is necessary for the system to function.
7. Create some ads
Publish some new ads to your Advertising weblog. Here’s what you’ll be doing with each field:
Category: Select the place(s) in your template where this ad will appear.
Entry Date/Expiration Date: Use these fields if the ad will start running on a particular date and/or stop running on a particular date. Otherwise, you can leave them blank.
Banner type: Do you have an actual banner or will you be pasting some Google AdSense or other code? Select “image” for a banner; otherwise select “HTML”. If you select HTML, you can skip the next 5 fields to the “HTML” field below.
Banner Artwork: You can either click your mouse in this field and then click “Upload Image” or you can upload the image to your banners directory via FTP and simply type in the file name of the uploaded image.
Banner Width: The width of the image. This avoids the need for PHP on the page as you see in Subvert’s method.
Banner Height: The height of the image. Ditto the above comment.
Banner Link: The URL people will be taken to when they click the banner. This is optional if you’d like to display a banner that people can view but not click on.
Target: Do you want the above link to open in a new window or replace the page they’re currently viewing? My rule of thumb: If the link is an internal link on my site, I set this to “_top” (same window); if it is an external link, I set it to “_blank” (new window).
HTML (if no image): Paste the code for your Google AdSense, CJ SmartZone, or other banner code that isn’t a simple image called up from your server.
Banner Rank: Like Subvert, this is a field I have set up but have not yet implemented. It is intended to determine the rank of banners when more than one will appear. For the time being I am setting all of them to “1”.
(continued in the next post in this thread…)