Git Product home page Git Product logo

advert_selector's Introduction

AdvertSelector

Rails adserver tool for selecting a smaller subset of banners from all possible banners with differing banner placement combinations. Gem includes admin tools for handling banners in live environment. Includes basic targeting, viewcount, frequency etc setups.

Good for deciding e.g. what height of header banner you will have during the initial requests without extra javascript calls to adserver. This helps to avoid problems of browser not knowing what size of banner there is and enables browser to render the whole page faster.

Features

  • selecting small subset of (advert) banners from multiple banners
    • banners can be also be any kind of widgets
  • defining banners
    • setting filters to banners in a rails friendly way
  • defining placements
    • setting conflicting placements
    • setting filters for placements
  • admin tools
    • editing everything
    • testing banners before setting it to live env
    • showing information in banner testing
    • showing error log if there is a problem in banner filters

Install

in /gemfile
  gem 'advert_selector'

# Run following
# bundle
# bundle exec rake railties:install:migrations
# rake db:migrate

in top of views/layouts/your_layout
  <% advert_selector_initialize(:all) %>
  and if you want testing info then at the bottom
  <%= advert_selector_force_test_infos %>

set to somewhere in your layout e.g.
  <%= content_for :banner_header %>

in config/routes
  mount AdvertSelector::Engine => "/advert_selector"

test the admin tool in url
  http://localhost:3000/advert_selector/

If you have problems, try to install simple_form again by setting `gem simple_form` to .Gemfile.

Configuration

set extra_configuration in /config/initializers/advert_selector.rb


AdvertSelector.default_banner_test_url = "http://yourdomain.com/?"
self.default_time_zone = 'Helsinki'

class AdminAccessToGemTools
  def self.admin_access(controller)
    if !controller.session[:admin_logged].blank? || Rails.env.development?
      return true
    else
      return false
    end
  end
end
AdvertSelector.admin_access_class = AdminAccessToGemTools


Trageting / Content / HelperItem

All contents and targetings are done through HelperItem-model.

For targeting define custom helpers alongside your normal viewhelpers. Start by name advert_selector. E.g

module AdvertSelectorHelper
  def advert_selector_targeting_gender?(helper_item)
    params[:gender] == helper_item.content
  end
end

And in banner define HelperItem with name 'targeting_age?' and content 'male'. After that the banner would be shown only with
requests that has param[:gender]='male'.

For displaying banner content

HelperItems that are tagged with content_for are used with content_for method in rails. E.g. HelperItem.name = :banner_header and then in your views you display results by <%= content_for :banner_header %>

Inside

Banners are read to ruby processes memory once every 10 minutes from sql database. Gem uses Rails.cache to cache viewcount of banners. Viewcount is updated to db once in a while.

Remember that this is not the real viewcount that more advanced banner handling systems have. Bots e.g. will increase the viewcount number

Some links you might also consider

Requirements

Gem has been tested with ruby 1.8.7, 1.9.2 and Rails 3.2.

Support

Submit suggestions or feature requests as a GitHub Issue or Pull Request. Remember to update tests. Tests are quite extensive.

Licence

This project rocks and uses MIT-LICENSE.

advert_selector's People

Contributors

holli avatar

Watchers

Casper Peter Lotter avatar  avatar  avatar  avatar  avatar James Cloos avatar Brad Kingon avatar Markus Kuhn avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.