<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ryan Campbell &#187; Google AdSense</title>
	<atom:link href="http://www.ryancampbell.com/category/google-adsense/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ryancampbell.com</link>
	<description>Flex/Flash Developer Blog</description>
	<lastBuildDate>Fri, 30 Jul 2010 03:46:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Adobe Flex and Google AdSense</title>
		<link>http://www.ryancampbell.com/2007/12/11/adobe-flex-and-google-adsense/</link>
		<comments>http://www.ryancampbell.com/2007/12/11/adobe-flex-and-google-adsense/#comments</comments>
		<pubDate>Tue, 11 Dec 2007 17:39:35 +0000</pubDate>
		<dc:creator>Ryan Campbell</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Google AdSense]]></category>

		<guid isPermaLink="false">http://wp.bobjim.com/wordpress/2007/12/11/adobe-flex-and-google-adsense/</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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.</p>
<p>For those who don't like reading, a quick summary of what I did is:</p>
<p>1. Create a search engine friendly HTML version of my content (home page, category/search results, ad full details)<br />
2. Add a param that will toggle displaying the Google AdSense banner at the top of that content<br />
3. Use the <a href="http://ccgi.arutherford.plus.com/blog/wordpress/?p=133">IFrame</a> component to load the banner in an iframe<br />
4. Reload the iframe as the user views different content<br />
5. Have a beer!</p>
<p>You can see an example of this in use at <a href="http://www.shopcarro.com" target="_blank">www.shopcarro.com</a>.<span id="more-21"></span><strong>1. Create a search engine friendly HTML version of my content (home page, category/search results, ad full details)</strong></p>
<p>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.</p>
<p>For example www.shopcarro.com/ad/8435 displays html to search engines/browsers without flash and redirects to www.shopcarro.com/#view=ad;id=8435 for browsers with flash installed.</p>
<p><strong>2. Add a param that will toggle displaying the Google AdSense banner at the top of that content</strong></p>
<p>This step was required because I only want Google AdSense banners in the iframe and not in the regular search engine indexed pages</p>
<p><strong>3. Use the <a href="http://ccgi.arutherford.plus.com/blog/wordpress/?p=133" target="_blank">IFrame</a> component to load the banner in an iframe</strong></p>
<p>The IFrame content is fairly simple to use: &lt;IFrame id="adSense" source="/ad/1234?adsense=1"/&gt;I only had to fix a few issues:</p>
<p>- 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</p>
<p>- 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:</p>
<p>this.addEventListener("xChanged", function(event:Event):void { moveIFrame(); });<br />
this.addEventListener("yChanged", function(event:Event):void { moveIFrame(); });</p>
<p>- 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.</p>
<p><strong>4. Reload the iframe as the user views different content</strong></p>
<p>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.</p>
<p><strong>5. Have a beer!</strong></p>
<p>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.</p>
<p>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!</p>
<p>UPDATE: The example url has changed from www.petsbc.com to <a href="http://www.shopcarro.com">www.shopcarro.com</a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.ryancampbell.com/2007/12/11/adobe-flex-and-google-adsense/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>
