Giter VIP home page Giter VIP logo

adsense_mobile's Introduction

Gem Version

AdsenseMobile

It is a helper to create the google adsense page-level ads tag in rails. Instead of using vanilla javascript for managing google adsense, it would be easier and hassle free to use adsense_mobile_tag tag to achieve the same.

Installation

Add below line to your application's Gemfile:

gem 'adsense_mobile'

And then execute:

$ bundle

Or install it yourself as:

$ gem install adsense_mobile

Usage

Basic page-level ads

<%= adsense_mobile_tag client: 'ca-pub-269xxxxxxxxxx' %>

Currently, the Page-level ads family includes the Anchor/overlay and Vignette ad formats, see the Google Documentation Guide.

Place below tag in the <head> section (or at the top of the <body>) of the pages where you want to show the ads.

  1. For Anchor/overlay ads

<%= adsense_mobile_tag client: 'ca-pub-269xxxxxxxxxx', overlays: '89xxxxxxx' %>

  1. For Vignette ads

<%= adsense_mobile_tag client: 'ca-pub-269xxxxxxxxxx', vignettes: '70xxxxxxx' %>

  1. For Anchor and Vignette ads

<%= adsense_mobile_tag client: 'ca-pub-269xxxxxxxxxx', vignettes: '70xxxxxxx', overlays: '89xxxxxxx' %>

It automatically maps required parameter according to google adsence API.

     client: 'ca-pub-269xxxxxxxxxx'    google_ad_client: 'ca-pub-269xxxxxxxxxx'
   overlays: '89xxxxxxx'                       overlays: { google_ad_channel: '89xxxxxxx' }
  vignettes: '70xxxxxxx'                      vignettes: { google_ad_channel: '70xxxxxxx' }

NOTE: If environment is not production, it'll show passed parameters in span tag.

{:client=>"ca-pub-2691264448085943", :vignettes=>"7013276711", :overlays=>"7013276711"}

To test page-level ads on production or on a mobile device, visit your page (website) and add #googleads to the end of the URL and reload the page.

If parameters are invalid, it shows error massage in span tag.

You are passing wrong parameters, please check documentation.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/adsense_mobile. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

adsense_mobile's People

Contributors

gaurav2728 avatar

Stargazers

 avatar

Watchers

 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.