Google Analytics for Myspace

myspaceGA

Tracking without JavaScript using gaforflash

I offer you a ready-made tracker for Google Analytics (GA) that can be used in Myspace or any other place where you are not allowed to use JavaScript. For those who speak geek this is nothing new, this is mainly dedicated to non-users of flash.

As I was customizing the myspace profile for by friends’ punk rock band Cacophonics I realized the need to track users. As Google Analytics (my tracking system of choice) uses JavaScript but Myspace does not support that I set up a small tracker using gaforflash.

Once you have a GA account and have uploaded somewhere the myspaceGA.swf file you only need to copy the following code in your About section in Myspace and modyfie the highlighted values to represent your GA account number, url to locate the myspaceGA.swf and the color of the 1 by 1 pixel area the swf file will take to match the background.

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" height="1" width="1">
<param name="movie" value="http://www.edzis.com/random/myspaceGA.swf?account=UA-XXXXXXXX-Y" />
<param name="bgcolor" value="080808" />
<embed type="application/x-shockwave-flash" src="http://www.edzis.com/random/myspaceGA.swf?account=UA-XXXXXXXX-Y" height="1" width="1" bgcolor="080808" />
</object>

In case you do not have your own hosting server where to keep your own copy of myspaceGA.swf you can risk to use the current url for it. However but I do not guarantee that the file will always be there and available to you. In case of any changes I will notify everyone who posts a comment on this blog.

And just in case you want to know how this was done – here is the code you can use:

package {
	import com.google.analytics.AnalyticsTracker;
	import com.google.analytics.GATracker;
	import flash.display.Sprite;
	import flash.events.Event;

	/**
	 * ...
	 * @author Edgars Simsons, edzis on edzis (dot) com, www.edzis.com
	 */
	public class Main extends Sprite {
		private var tracker	:AnalyticsTracker;

		public function Main():void {
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}

		private function init(e:Event = null):void {
			removeEventListener(Event.ADDED_TO_STAGE, init);
			// entry point

			var account:String = loaderInfo.parameters.account;

			if (account == null || account == "") return;
			tracker = new GATracker(this, account);
			tracker.trackPageview();
		}
	}
}
This entry was posted in Uncategorized. Bookmark the permalink.

One Response to Google Analytics for Myspace

  1. Jeff says:

    Hi!!

    I’ve tried this program and it works very well!! I’m very happy thank you a lot!!

    Only one thing…I can’t see the time that the people spend on my page…is it possible to solve this?

    Anyway, thanks so much!!

    Jeff

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>