1
如何使用Google地图图层在OpenLayers内使用Google Adsense?OpenLayers + Google adsense
代码使用AdSense谷歌地图(V2)地图内:
map = new GMap2(document.getElementById("Gmap"));
adsManager = new GAdsManager(
map,
"ca-pub-xxxxxxxxxxxxxxxx",
{
maxAdsOnMap : 4,
style: 'adunit'
}
);
adsManager.enable();
## The HTML:
<div id="Gmap"></div>
守则的OpenLayers显示谷歌地图:
map = new OpenLayers.Map("olmap")
var gmap = new OpenLayers.Layer.Google("Google Streets", {numZoomLevels: 20});
map.addLayers([gmap]);
## The HTML:
<div id="olmap"></div>
有没有什么办法让谷歌地图内的openlayers对象?然后我可以使用第一个代码来添加广告。
请注意,Google地图adsense库现在已被弃用:https://developers.google.com/maps/documentation/javascript/advertising – 2016-04-11 10:39:57