<?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>Bytearray - Programming, Computers and Technology &#187; Google</title>
	<atom:link href="http://bytearray.brixtonjunkies.com/tag/google/feed/" rel="self" type="application/rss+xml" />
	<link>http://bytearray.brixtonjunkies.com</link>
	<description></description>
	<lastBuildDate>Tue, 03 Nov 2009 11:52:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>New: Google Fast Flip</title>
		<link>http://bytearray.brixtonjunkies.com/2009/09/15/new-google-fast-flip/</link>
		<comments>http://bytearray.brixtonjunkies.com/2009/09/15/new-google-fast-flip/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 09:33:29 +0000</pubDate>
		<dc:creator>alchemist</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[fastflip]]></category>

		<guid isPermaLink="false">http://bytearray.brixtonjunkies.com/?p=370</guid>
		<description><![CDATA[Looks like GoogleLabs are working on something new FastFlip, which appears to be a &#8220;flippy&#8221; news reader. It essentially screen shots important news from various sites, catalogs them and displays them with a &#8220;flippy&#8221; browse view. In conjunction with the browse view you can drill down and view a screen shot of the websites main [...]]]></description>
			<content:encoded><![CDATA[<p>Looks like GoogleLabs are working on something new <strong>FastFlip</strong>, which appears to be a &#8220;flippy&#8221; news reader. It essentially screen shots important news from various sites, catalogs them and displays them with a &#8220;flippy&#8221; browse view. In conjunction with the browse view you can drill down and view a screen shot of the websites main page and if need be click and follow through to the actual site.</p>
<p style="text-align: center;"><a href="http://bytearray.brixtonjunkies.com/wp-content/uploads/2009/09/FastFlip.jpg"><img class="size-full wp-image-372 aligncenter" title="Google FastFlip" src="http://bytearray.brixtonjunkies.com/wp-content/uploads/2009/09/FastFlip.jpg" alt="Google FastFlip" width="518" height="267" /></a><a href="http://bytearray.brixtonjunkies.com/wp-content/uploads/2009/09/FastFlip2.jpg"><img class="size-full wp-image-376 aligncenter" title="Google FastFlip" src="http://bytearray.brixtonjunkies.com/wp-content/uploads/2009/09/FastFlip2.jpg" alt="Google FastFlip" width="518" height="114" /></a></p>
<p style="text-align: center;"><a rel="nofollow" href="http://fastflip.googlelabs.com/" target="_blank">fastflip.googlelabs.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://bytearray.brixtonjunkies.com/2009/09/15/new-google-fast-flip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex: Google Analytics Howto</title>
		<link>http://bytearray.brixtonjunkies.com/2009/08/20/flex-google-analytics-howto/</link>
		<comments>http://bytearray.brixtonjunkies.com/2009/08/20/flex-google-analytics-howto/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 17:51:20 +0000</pubDate>
		<dc:creator>alchemist</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[google analytics]]></category>

		<guid isPermaLink="false">http://bytearray.brixtonjunkies.com/?p=54</guid>
		<description><![CDATA[How do you track events in Google Analytics (GA)? Well it&#8217;s easy enough when your&#8217;re dealing with regular html markup web pages (I&#8217;m assuming your&#8217;ve done a basic implementation of Google Analytics before), but what about flex. Once the webpage that your main flex application sits in is loaded nothing else will be tracked by [...]]]></description>
			<content:encoded><![CDATA[<p>How do you track events in Google Analytics (GA)? Well it&#8217;s easy enough when your&#8217;re dealing with regular html markup web pages <em>(I&#8217;m assuming your&#8217;ve done a basic implementation of Google Analytics before)</em>, but what about flex. Once the webpage that your main flex application sits in is loaded nothing else will be tracked by GA.</p>
<p>The easiest way to track any action in a Flex application using GA is to use the Flex-Javascript bridge in <strong>flash.external.ExternalInterface</strong></p>
<p>Also you don&#8217;t want any possibility that Flex is going to hang around for the Javascript call to complete, and if there&#8217;s a communication issue then GA could slow down your program. So in a nunshell  what is needed is an asynchronous event driven framework for GA which is implemented around Flex ExternalInterface calls to Javascript.</p>
<p>In order to make the below example work you will need a Google account with Analytics setup on a domain. You will need to check your supplied GA Javascript code and find your unique tracking ID, which will look something like: UA-xxxxxxx-x. You can setup and test the below code to a point in FlexBuilder but ultimately you will need to integrate your code onto your website URL which is registered with GA. The GA Javascript code will not execute unless it&#8217;s running integrated on your website <em>(it&#8217;s most likely due to Javascript environment variables or the lake of)</em></p>
<p><strong>Tip:</strong><br />
You need a tool to monitor HTTP traffic from your browser, Firefox has plug-in call: Tamper Data which works well enough. </p>
<p><em><strong>This is the core Google Analytics code which should always be listening for Flex tracking events and ultimately makes the Javascript call to track your custom event. </strong></em></p>
<pre class="brush: as3;">
package Framework.Utilities.GoogleAnalytics{

	import Framework.Utilities.GoogleAnalytics.Events.TrackingEvent;
	import Framework.Utilities.JavascriptAPI;

	import flash.events.EventDispatcher;

	public class GoogleAnalytics{

		private var globalEventDispatcher:EventDispatcher = null;

		private var trackingId:String = '';

		private var javascriptApi:JavascriptAPI = null;

		public static const GANALYTICS_URI_SOAP_PREFIX:String = '/SOAP/';

		public static const GANALYTICS_URI_UI_PREFIX:String = '/UI/';

		public function GoogleAnalytics(globalEventDispatcher:EventDispatcher,trackingId:String = ''){
			this.trackingId = trackingId;
			this.globalEventDispatcher = globalEventDispatcher;
			javascriptApi = new JavascriptAPI();
			initListeners();
		}

		public function setTrackingId(trackingId:String):void{
			this.trackingId = trackingId;
		}

		public function getTrackingId():String{
			return trackingId;
		}

		private function initListeners():void{
			this.globalEventDispatcher.addEventListener(TrackingEvent.GOOGLE_TRACKING_EVENT,trackingHandler);
		}

		private function trackingHandler(te:TrackingEvent):void{
	    	var currentTrackingId:String = trackingId;
	    	if (te.getTrackingId() != null){
	    		if (te.getTrackingId() != ''){
	    			currentTrackingId = te.getTrackingId();
	    		}
	    	}

	    	if (currentTrackingId != null){
	    		if (currentTrackingId != ''){
	    			// Make the google analytics call via javascript
	    			javascriptApi.googleTracker(currentTrackingId,te.urlOrUrl);
	    		}
	    	}
		}

	}
}
</pre>
<p><em><br />
<strong>This is the tracking event which will hold your custom Google Analytics call which will be fired every time you want to track something in Flex.</strong></em></p>
<pre class="brush: as3;">
package Framework.Utilities.GoogleAnalytics.Events{

	import flash.events.Event;

	public class TrackingEvent extends Event{

	    public static const GOOGLE_TRACKING_EVENT:String = 'GOOGLE_TRACKING_EVENT';

	    public var urlOrUrl:String = '';

	    private var trackingId:String = '';

	    public function TrackingEvent(urlOrUrl:String,type:String = GOOGLE_TRACKING_EVENT):void{
	    	this.urlOrUrl = urlOrUrl;
	    	super(type);
	    }

	    public function setTrackingId(trackingId:String):void{
	    	this.trackingId = trackingId;
	    }

	    public function getTrackingId():String{
	    	return trackingId;
	    }

		public override function clone():Event{
			var trackingEvent:TrackingEvent = new TrackingEvent(urlOrUrl,type);
			trackingEvent.setTrackingId(trackingId);

	    	return trackingEvent;
		}
	}
}
</pre>
<p><em><br />
<strong>This is a small class which uses the Flex ExternalInterface call to execute Google Analytics Javascript, which in turn makes an HTTP call to the GA server.  </strong></em></p>
<pre class="brush: as3;">
package Framework.Utilities{

	import flash.external.ExternalInterface;

	public class JavascriptAPI{

		public static const PLUGIN_MODE:int = 0;

		public static const AIR_MODE:int = 1;

		public static const GANALYTICS_URI_SOAP_PREFIX:String = '/SOAP/';

		private var mode:int = 0;

		public function JavascriptAPI(mode:int = 0){
			this.mode = mode;
		}

		public function googleTracker(trackerId:String,action:String):void{
			if (mode == PLUGIN_MODE){
				var js:String = &quot;function googleTracker(){&quot; +
								&quot;var pageTracker = _gat._getTracker('&quot; + trackerId + &quot;');&quot;+
								&quot;pageTracker._trackPageview('&quot; + action + &quot;');}&quot;;
				ExternalInterface.call(js);
			}
		}
	}
}
</pre>
<p><em><br />
<strong>This is how you use the above code</strong></em></p>
<pre class="brush: as3;">

/**
 * Where myEventDispatcher extends an EventDispatcher
 */

var googleAnalytics:GoogleAnalytics = new GoogleAnalytics(myEventDispatcher);
googleAnalytics.setTrackingId(myGoogleAnalyticsId);

/**
 * Then somewhere else in your application do this
 * to track your something in Google Analytics
 */

var googleTrackingEvent:TrackingEvent = new TrackingEvent('myTrackingStringOrUrl');
myEventDispatcher.dispatchEvent(googleTrackingEvent);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://bytearray.brixtonjunkies.com/2009/08/20/flex-google-analytics-howto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wordpress Adsense &#8211; Ad Targeting Redirect</title>
		<link>http://bytearray.brixtonjunkies.com/2009/08/20/wordpress-adsense-ad-targeting-redirect/</link>
		<comments>http://bytearray.brixtonjunkies.com/2009/08/20/wordpress-adsense-ad-targeting-redirect/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 16:16:47 +0000</pubDate>
		<dc:creator>alchemist</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[ad targeting]]></category>
		<category><![CDATA[adsense]]></category>
		<category><![CDATA[header redirect]]></category>
		<category><![CDATA[permalink]]></category>

		<guid isPermaLink="false">http://bytearray.brixtonjunkies.com/?p=60</guid>
		<description><![CDATA[When I was a Adsense n00b I made the mistake of adding adding a witty statement in my tagline in wordpress which confused adsense in terms of the content of my site, despite all the search engine optimization I had done . The symptom was: only the main index of my site had ads targeted [...]]]></description>
			<content:encoded><![CDATA[<p>When I was a Adsense n00b I made the mistake of adding adding a witty statement in my tagline in wordpress which confused adsense in terms of the content of my site, despite all the search engine optimization I had done . The symptom was: <span style="text-decoration: underline;">only</span> the main index of my site had ads targeted solely on the wordpress &#8220;tagline&#8221; <em>(the strip of text under the main title)</em>,  all other pages on my site were targeted correctly. I thought this would be a matter of simply changing the tagline&#8230;but no, google doesn&#8217;t forget! I wont go into detail about the type of ads that were being targeted, lets just say they weren&#8217;t ideal.</p>
<p>A simple effective work around is a header redirect <em>(permalink friendly)</em> on the main site index which can be prefixed to the wordpress index.php in your wordpress top level directory. </p>
<pre class="brush: php;">
&lt;?php

// set $redirectHome = false to disable the redirect

$redirectHome = true;
if ($redirectHome){
        // Redirects index page
        $uriStr = $_SERVER['REQUEST_URI'];
        if (($uriStr == '/') || ($uriStr == '')){
                header('Location: /?index',true,301);
                die();
        }
        // Makes sure pages off the main index are not renamed
        $matchAry = array();
        if (preg_match('/(\/page\/\d+\/)\?index/',$uriStr,$matchAry)){
                header('Location: ' . $matchAry[1],true,301);
                die();
        }
}

/**
 * Original Wordpress index.php goes here
 */
</pre>
<p>This works because Google thinks &#8220;/?index&#8221; is a new page <em>(it&#8217;s not though, it&#8217;s the main index with a query string attached)</em> and the media bot crawls it and targets it accordingly as a new page. And as long as you&#8217;ve made your amendments to your previously incorrect content, in my case the &#8220;tagline&#8221; then this time around your ads should be accurately targeted&#8230;hopefully <img src='http://bytearray.brixtonjunkies.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The curious thing is, it seems no matter what only my original main index is targeted incorrectly still months later. I&#8217;ve seen other posts relating to incorrect ad targeting on the main index only. It seems like Google&#8217;s media crawler doesn&#8217;t like something about Wordpress, I would like to hear from others that have experienced this.</p>
]]></content:encoded>
			<wfw:commentRss>http://bytearray.brixtonjunkies.com/2009/08/20/wordpress-adsense-ad-targeting-redirect/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
