Adobe Flex 和 Google AdSense

导读:
  I've recently launched a Flex-based classified ads product allowing anyone to start a classified ads service. Almost the very first question I was asked was how to place a Google AdSense banner in to their app. I really didn't want to tell them that wasn't possible because I choose to use Flex. Instead I set out to find a solution. It turns out not only was it possible but it was a lot less complicated than I imagined. 我最近发布了一款基于FLEX的可分类的广告服务。我被问到的最多的问题是如何将ADSENSE广告标题栏放进他们的程序,我真的不想告诉他们因为我使用了FLEX所以那不可以。于是我着手解决这个问题,结果发现比我想象的要容易的多
  For those who don't like reading, a quick summary of what I did is: 对于那些不喜欢月的的人来说下面是我方案的摘要
  1. Create a search engine friendly HTML version of my content (home page, category/search results, ad full details) 创建一个搜索引擎友好的HTML页面
  2. Add a param that will toggle displaying the Google AdSense banner at the top of that content 添加一个参数以显示GA的标题栏在正中心
  3. Use the IFramecomponent to load the banner in an iframe 使用IFramecomponent组件来加载广告的标题栏
  4. Reload the iframe as the user views different content 重新装载IFRAME是用户看到不同的内容
  5. Have a beer! 收工庆祝
  You can see an example of this in use at www.petsbc.com. 在这个网站上可以看见一个例子
  1. Create a search engine friendly HTML version of my content (home page, category/search results, ad full details)


(步骤已经翻译过了所以下面不再累述)
  This is something I had actually already completed a few weeks earlier. I felt making sure the classifieds content was indexable by search engines was super important. Search results, category listings and ad full details all have clean urls that are bookmarkable. 这其实是我几个星期以前就已经做好的东西了。我希望分类的内容能够被搜索引擎索引是非常非常重要的,搜索的结果,类别列表,详细的细节以及干净的URL连接以方便用户添加书签
  For example www.petsbc.com/ad/8435 displays html to search engines/browsers without flash and redirects to 例如此URL显示了搜索引擎的索引www.petsbc.com/#view=ad;id=8435 for browsers with flash installed.
  2. Add a param that will toggle displaying the Google AdSense banner at the top of that content
  This step was required because I only want Google AdSense banners in the iframe and not in the regular search engine indexed pages 这一步是必须的因为,GA的标题不是常规的搜索引擎索引页
  3. Use the IFramecomponent to load the banner in an iframe
  The IFrame content is fairly simple to use: <iframe id="adSense" source="/ad/1234?adsense=1"></iframe>
  I only had to fix a few issues: 需要补充几点注意事项
  - The flash player was redrawing itself over top of the IFrame. This is fixed by setting wmode="opaque" in the javascript, object tag and embed tag that load your Flex app FP会在IFRAME顶端自动重绘,通过在JS脚本里设置 wmode="opaque"解决问题
  - I was using the left and bottom constraints to anchor the banner to the bottom of my app but the html IFRAME wasn't moving when I resized the browser window. Easily fixed by adding the following to the IFrame component code: 我使用了左底下限制链接矛在底部,但是当我改变浏览器的大小的时候IFRAME并没有移动,通过添加以下代码解决
  this.addEventListener("xChanged", function(event:Event):void { moveIFrame(); });
  this.addEventListener("yChanged", function(event:Event):void { moveIFrame(); });
  - Since the iframe is infront of the flash player, any Flex pop ups (TitleWindows, etc.) will appear behind the iframe. I was running out of time so I just simply set the visible property on the IFrame component to false/true whenever I show/hide a PopUp. 因为IFRAME在FP的前面,任何FLEX弹出框会出现在IFRMAE的签名,所以我将IFRMAE项的可视属性设置为假,当我想隐藏一个弹出框的时候,反之亦然
  4. Reload the iframe as the user views different content
  Lastly, whenever the user views different content, I change the source property on the IFrame component to the html based version of that same content. This allows ads to be displayed that are relevant to what the user is currently viewing. 最后不管什么时候用户查看不同的内容,我改变了源代码属性为HTML基础的相同内容。这使得ADS可以和用户正在看内容相关
  5. Have a beer!
  Although some might argue using an iframe with Flex is more of a hack than a solution, the web is based on hacks and hey it works.
  If you're trying to get this working in your own app and run in to any snags let me know, I'll try my best to help out! 完成,也许有人会说使用IFRAME和FLEX与其说是解决方案不如说是投机取巧。但是如果你有你的解决方案的话,那很酷,别忘了告诉我

本文转自
http://www.bobjim.com/2007/12/adobe_flex_and_google_adsense.html

你可能感兴趣的:(搜索引擎,Flex,Google,Flash,Adobe)