Showing posts with label Google Maps. Show all posts
Showing posts with label Google Maps. Show all posts

24/11/2016

couch mode print story

How to Monetize Google Maps on your Website with AdSense Ads


How to Monetize Google Maps on your Website with AdSense Ads

Learn how to embed Google Maps on your website with AdSense ads. You can create ad units inside your existing AdSense account to monetize Google maps.

You have been using Google AdSense ads to monetize the content of your website but did you know that you can also use the same AdSense program to also monetize any Google Maps that are embedded on your web pages. You can embed a Google Map and AdSense ads will be automatically served inside the map that will either be contextually relevant to the content of the page or targeted based on the location of the visitors.
The Google Maps block embedded below contains a rectangular AdSense ad unit placed near the top-center area of the map. Where Am Iis another example of a website that embeds Google Maps with ads.

AdSense Ads for Embedded Google Maps

Google Maps offers you an easy option to embed maps onto your website but the default embed code does not allow monetization. You’ll have build the map on your own using the Google Maps API to enable advertising and this isn’t difficult either. Let me show you in few easy step.
To get started, go to the Google AdSense website and create a new ad unit. You can choose the default color scheme for the ad unit (white background) and pick responsivefor the size. The latter doesn’t matter though as the ad unit will automatically fit inside the container map.
Next, copy-paste the following Google Maps embed code anywhere in your web template.

  1. <div id="google-maps" style="width:500px; height:500px;"></div>

  2.  

  3. <script src="https://maps.googleapis.com/maps/api/js?v=3.exp">

  4. </script>

  5. <script src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js">

  6. </script>

  7.  

  8. <script>

  9.  

  10. function showGoogleMaps() {

  11.  

  12. var mapOptions = {

  13. center: new google.maps.LatLng(38.8977, -77.036),

  14. zoom: 5

  15. };

  16.  

  17. var map = new google.maps.Map(

  18. document.getElementById('google-maps'), mapOptions);

  19.  

  20. var ad = '<ins class="adsbygoogle" \

  21. style="display:inline-block;width:300px;height:100px" \

  22. data-ad-client="ca-pub-xxxx" \

  23. data-ad-slot="yyyy"></ins>';

  24.  

  25. var adNode = document.createElement('div');

  26. adNode.innerHTML = ad;

  27.  

  28. map.controls[google.maps.ControlPosition.TOP_CENTER].push(adNode);

  29.  

  30. google.maps.event.addListenerOnce(map, 'tilesloaded', function() {

  31. (adsbygoogle = window.adsbygoogle || []).push({});

  32. });

  33.  

  34. }

  35.  

  36. google.maps.event.addDomListener(window, 'load', showGoogleMaps);

  37.  

  38. </script>


You can replace the height and width of the Google Maps in line #1 to fit your website layout while the latitude and longitude of the place needs to be replaced in line #11. Finally, xxxx and yyyy in the embed code should be replaced with your AdSense Publisher ID and the Ad Slot ID respectively. You can find these values in the embed code generated by AdSense.
If you are ready to fiddle with the JavaScript, you can even more option to customize the embedded map.
Google Maps with AdSense Ads
For instance, you can easily change the position of the AdSense ad unit inside Google Maps from TOP_CENTER (line #28) to BOTTOM_CENTER or something else.
Similarly, you can change the default view of the embedded map from Roadmap to Satellite or Hybrid. The various controls inside the Google map – like the street view Pegman, the zoom slider, the pan control – can be easily hidden or moved to a different position by setting the corresponding properties inside the mapOptions object.


  1.  

  2. var mapOptions = {

  3.  

  4. // Center the map on this address

  5. center: new google.maps.LatLng(38.8977, -77.036),

  6.  

  7. // Set the initial zoom level

  8. zoom: 14,

  9.  

  10. // Hide the slider to control the zoom levels

  11. zoomControl: false,

  12.  

  13. // Hide the controls to pan the map

  14. panControl: false,

  15.  

  16. // Display the street view peg but in a different position

  17. streetViewControl: true,

  18. streetViewControlOptions: {

  19. position: google.maps.ControlPosition.BOTTOM_CENTER

  20. },

  21.  

  22. // Allow visit to switch to Satellite view and back

  23. mapTypeControl: true,

  24.  

  25. // Set the default type of the map to Roadmap

  26. mapTypeId: google.maps.MapTypeId.ROADMAP

  27.  

  28. };

  29.  

  30. </script>


23/11/2016

couch mode print story

See all your Google Contacts on a Google Map

24 Nov. 2016

See all your Google Contacts on a Google Map

Learn how to create a Google Map using the current postal addresses of your Google Contacts. The maps are automatically saved in your Google Drive.
Want to know where you friends and colleagues are? The all-new Map My Contacts app will help you quickly visualize the location of your Google contacts on a world map. It reads the postal addresses of people from your Google Contacts and puts them all in a Google Map using a simple Google script.
Google Contacts on a World Map
Create a Google Map with your Google Contacts

Publish a Map of Google Contacts

It takes one easy step to turn your address book into a Google Map. If you are Google Chrome user, you can install an add-on or you can click here to directly access the “Map My Contacts” web app in any other browser.
The app will require authorization because it needs to read the addresses of your Google Contacts and it needs access to Google Drive for saving the generated map. It is an open-source Google Script and you get find the entire source codeon ctrlq.org published under the MIT License.
Once you have authorized and granted access, the app will run for a few minutes, depending on how big your address book is, and generates a Google Map embeddedin an HTML file. A KML file is also created in your Google Drive with markers (or placemarks) for every contact and you can double-click to open this file inside Google Earth.
Also, if you are not using Google Contacts as your primary address book, you can still use the apps to map your contacts. Just export the contacts data from your existing address book (like Outlook or Yahoo Mail) as a CSV file, import the file into Google Contacts and run the app again.
Internally, the Google Apps Script reads the home and work postal addresses of your Google Contacts and then uses the geocoding service of Google Maps to transform these human-readable addresses into latitudes and longitude values. These points are then put in a KML file (see sample KML file) that can viewed inside Google Earth or Google Maps.
See some of our other useful Google Scripts.