Code Monkey home page Code Monkey logo

nesta-plugin-google-ads's Introduction

Nesta::Plugin::Google::Ads

Include google ads in your Nesta CMS applciation.

Installation

Add this line to your application's Gemfile:

gem 'nesta-plugin-google-ads'

And then execute:

$ bundle

Or install it yourself as:

$ gem install nesta-plugin-google-ads

Usage

  1. Update your configs. [optional if you're passing params to helper, see below]

     # config/config.yml
     # this sets default which can be overriden in your helper
     # call
     google_ad:
       client: google_client_id
       slot:   google_ad_slot_id
       width:  google_ad_width
       height: google_ad_height
    
  2. Add helper method to your layout.haml or where you want it.

     # views/layout.haml
     -#- ... layout contents ...
    
     = google_ad
    
     -#- ... layout contents ...
    

'google_ad' helper also takes a hash of google_ad keys, which will override defaults set in config/config.yml.

Example:

  = google_ad( "width" => 200, "height" => 200 )

Examples

Postal3

Menu Ad

    # file: views/index.haml
      1 #header
      2   %h1#logo
      3     %a{ :href => "/" }= @heading
      4     %small= no_widow @subtitle
      5 
      6 #sidebar
      7   = haml :categories, :layout => false
      8   = haml :feed, :layout => false
      9   = haml :about, :layout => false
     10   = google_ad
     11 
     12 #content
     13   - @articles.each do |article| 
     14     = haml :summary, :layout => false, :locals => { :article => article, :heading => :h2 }

Top Ad

    # file: views/index.haml
      1 #header
      2   %h1#logo
      3     %a{ :href => "/" }= @heading
      4     %small= no_widow @subtitle
      5 
      6 #sidebar
      7   = haml :categories, :layout => false
      8   = haml :feed, :layout => false
      9   = haml :about, :layout => false
     10 
     11 #content
     12   = google_ad
     13   - @articles.each do |article| 
     14     = haml :summary, :layout => false, :locals => { :article => article, :heading => :h2 }

Bottom Ad

    # file: views/index.haml
      1 #header
      2   %h1#logo
      3     %a{ :href => "/" }= @heading
      4     %small= no_widow @subtitle
      5 
      6 #sidebar
      7   = haml :categories, :layout => false
      8   = haml :feed, :layout => false
      9   = haml :about, :layout => false
     10 
     11 #content
     12   - @articles.each do |article| 
     13     = haml :summary, :layout => false, :locals => { :article => article, :heading => :h2 }
     14   = google_ad

Multiple Ads

    # file: views/index.haml
      1 #header
      2   %h1#logo
      3     %a{ :href => "/" }= @heading
      4     %small= no_widow @subtitle
      5 
      6 #sidebar
      7   = haml :categories, :layout => false
      8   = haml :feed, :layout => false
      9   = haml :about, :layout => false
     14   = google_ad("slot" => 0000000000, "width" => 200, "height" => 200)
     10 
     11 #content
     12   - @articles.each do |article| 
     13     = haml :summary, :layout => false, :locals => { :article => article, :heading => :h2 }
     14   = google_ad

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

nesta-plugin-google-ads's People

Contributors

jmervine avatar

Watchers

 avatar  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.