• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • About
  • Projects
    • GStaticMap WP Plugin
  • Contact
  • Privacy Policy

Lorenz Blog

All About Web & Mobile Application Development

  • Featured Articles
  • Gadgets
    • Android
    • Blackberry
  • Programming
    • Android
    • PHP
    • Java Script
    • MySQL
    • Postgresql
    • Flex
    • Web
  • Software
    • Mac OS
    • Windows
    • Linux
  • Web
You are Here » Home >> Information Technology >> Programming >> Java Script >> How to Add Adsense into Your Google Map API Application

How to Add Adsense into Your Google Map API Application

February 25, 2010 by Lorensius Londa 15 Comments

There are two Adsense for Maps products  provided by Google to monetize Google Maps API application:

  • Advertising alongside local bussines search result using the GoogleBar that requires your Adsense account be enabled for Adsense for Search
  • Advertising based on map viewport using the Maps Ad Unit that requires your AdSense account be enabled for Adsense for Content.

Advertising using the GoogleBar

Adsense using the GoogleBar
Adsense using the GoogleBar
var map;
if (GBrowserIsCompatible()) {
    var mapOptions = {
         googleBarOptions : {
                 style : 'new',
                 adsOptions: {
                      client: 'your-publisher-id',
                      channel: 'your-ads-channel-id',
                      adsafe: 'high',
                      language: 'en'
                 }
         }
    }

    map = new GMap2(document.getElementById('map'), mapOptions);
    map.setCenter(new GLatLng(27.6648274, -81.5157535), 12);
    map.setUIToDefault();
    map.enableGoogleBar();
}

Line 06: adsense options:
Line 07: your adsense publisher ID
Line 08: your adsense for search channel (optional)
Line 09: ad safety level (optional)
Line 10: language in which to display results

Advertising using the Maps Ad Unit

Adsense using Maps Ad Unit
Adsense using Maps Ad Unit
var adsManagerOptions = {
  maxAdsOnMap : 2,
  style: 'your-ads-unit',
  channel: 'your-ads-channel-id'
};

var publisherID = 'your-publisher-ID';

adsManager = new GAdsManager(map, publisherID, adsManagerOptions);
adsManager.enable();

Line 01: specify ads options
Line 02: maximum number of ads
Line 03: your ads unit
Line 04: your ads channel id
Line 07: specify your publisher id
Line 09: construct the  GAdsManager object
Line 10: enable ads

Facebooktwitterredditpinterestlinkedinmailby feather

Related posts:

  1. How to Create Facebook Application with PHP for Beginner
  2. How to Setup Android Application Development on Eclipse
  3. How to Change Application Theme on Adobe Flex Builder 3
  4. How to Use Foursquare API on Android Application

Filed Under: Information Technology, Java Script, Programming Tagged With: adsense, adsense for map, adsense on google map, googlbar, google map, map ad unit

About Lorensius Londa

Passionate web and mobile application developer. Co-founder of TRUSTUDIO, loves programming, Android, aviation, travelling, photography, coffee and gym mania.

Reader Interactions

Comments

  1. Richard says

    March 10, 2010 at 7:45 am

    I am currently making a website. I am very new to all this! this actually makes no sense? what do I actually do with this code????

    thanks

    Reply
    • lorenz says

      March 12, 2010 at 10:58 pm

      Hi Richard, just put this code into your google map api application code, if you are new to google map programming, please read manuals and tutorials here

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

About Me

A husband, father of two, passionate software developer, diy lover and home baker who loves to learn new things. Read More…

  • Facebook
  • GitHub
  • Google+
  • Instagram
  • Twitter
  • YouTube

Featured Articles

How to Setup MQTT Server Using Mosquitto and Libwebsocket on Freebsd

Blue Bamboo P25 Printer Android Demo Application With Source Code

Simple JSON RPC Client for Android

How to Send Message to Google Cloud Messaging (GCM) Server Using JSON and PHP

Footer

Recent Comments

  • Aditya Dabas on About
  • Ayten Göksenin Barutçu on How to Make Android Map Scrollable Inside a ScrollView Layout
  • mang jojot on About
  • Hussain on How to Programmatically Scan or Discover Android Bluetooth Devices

Recent Posts

  • How to Fix Blank Screen on WordPress Add/Edit Post Page
  • How to Programmatically Restart the ESP32 Board
  • How to Get Hardware Info of ESP32
  • How to Setup MQTT Server Using Mosquitto and Libwebsocket on Freebsd

Latest Tweets

To protect our users from spam and other malicious activity, this account is temporarily locked. Please log in to https://twitter.com to unlock your account.

Copyright © 2023 · Magazine Pro on Genesis Framework · WordPress · Log in