Flash notes by Edzis

ActionScript programmer / Flash developer Edgars Simsons on professional stuff

Google Analytics for Myspace

with 46 comments

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();
		}
	}
}

Written by edzis

August 25th, 2009 at 9:27 am

Posted in flash

Tagged with ,

46 Responses to 'Google Analytics for Myspace'

Subscribe to comments with RSS or TrackBack to 'Google Analytics for Myspace'.

  1. Cool stuff! I have immediately added it to my punk rock band profile ;)

    Rostislav

    27 Aug 09 at 12:55

  2. This is exactly what I have been looking for. I am a newbie, and get most of it. How can I download a copy of the myspaceGA.swf file? Thanks.

    MD

    29 Aug 09 at 18:48

  3. A good point, MD. Here you can get the myspaceGA.swf file. And I also updated the post with a link.

    edzis

    29 Aug 09 at 21:35

  4. Thank you!

    MD

    29 Aug 09 at 23:04

  5. edzis, thanks for this. I am not sure what i am doing is correct. I paste in the code as you suggest and change the parameters. I am putting it in the About Me section. When I save changes and look at the site there are no single pixels whatever colour i choose. Additionally, myspace seems to be adding code to it when i save the changes. Below is an extract of your code i inserted and the additions from Myspace. I am new to this so any help you could provide would be appreciated. ( I have inserted the XXXX’s on purpose)

    Paul

    1 Sep 09 at 21:19

  6. …so okay blogs are also new to me… The parameters that myspace is adding are….

    param name=”allowScriptAccess” value=”never”
    param name=”allowNetworking” value=”internal”

    Upon further investigation it sounds like myspace are doing something to stop this working.

    Ta
    Paul.

    Paul

    1 Sep 09 at 21:27

  7. Yeah, it seems that myspace is adding transparency settings thus you will not see the pixel.
    But anyways I checked your myspace site with Charles Proxy and found out that the location you have specified for myspaceGA.swf is not accessible, in fact I can not open any site from that domain. Once you can access the file in browser it should be loaded by myspace and tracking info sent to GA.

    edzis

    1 Sep 09 at 22:28

  8. Added the code though status is currently: Tracking Unknown or Not Verified is this due to the way it works or have I installed in incorrectly?

    Thanks,

    James

    achilles

    12 Sep 09 at 20:59

  9. Ok, it’s working now. Thanks so much for this, will be very useful!

    James

    achilles

    13 Sep 09 at 02:20

  10. Hi Edzis – great site, I haven’t found anything else that has a user friendly (non techie like me) fix for this. I have your code pasted in the “about” section and my GA status says “collecting data”, but it isn’t registering any hits….all I know about would be me going to the website from my computer, but that should show up, right? Any ideas?

    Thanks!

    Dennis

    Dennis

    22 Sep 09 at 06:01

  11. Dennis, James and all other account starters, to calm you I can say that everything is happening as expected. Google collects all the data but it has not yet processed the information for your display. There is a delay for the gathered data to be visible for the user that is speculated to be from a couple of hours to a day.
    And another thing is that by default the ongoing day is excluded from the report – you have to manually select the data range to include the current date.

    edzis

    22 Sep 09 at 10:19

  12. Thanks, you are right of course. Leave it to me to ask the dumb question. Thanks again!

    Dennis

    Dennis

    22 Sep 09 at 16:57

  13. Thanks very much for your fine efforts. Your instructions are laid out very well. Thanks also for taking the time to answer questions here. Your comments are helpful to those of us experiencing angst because nothing seemed to be happening.

    Dave

    27 Sep 09 at 01:28

  14. Edzis, like the rest of us I want to thank you for this. Now I am trying to put this on my band’s myspace however we have to edit in safe mode and there is no “About Me” section. The sections that are there are “headline, bio, members, influences, sounds like, etc.” I was wondering what section I should put it in and also the url you’ve provided for the .swf is correct right?

    Eli

    8 Oct 09 at 17:16

  15. Thank you. This helps me a great deal.

    But I seem to notice that I don’t get enough page views. The pageviews are always the same as the visits. I think there should be more pagewies than visits (actually I know this because I load the page many times during the same visit). Do others have the same problem?

    Myspace: http://www.myspace.com/pyknics

    I think the unique users and visits are right though.

    Pyknic

    9 Oct 09 at 13:03

  16. Thanks, really helpful, and thanks for hosting the .swf aswell!

    Rob

    12 Oct 09 at 00:46

  17. Thanks for the good site and the hosting of the .swf =).

    Cheers

    Patrick

    31 Oct 09 at 11:03

  18. awesome! i have been looking for a way to do this for ages now!

    jonathan

    6 Nov 09 at 20:14

  19. [...] go here and follow the instructions, embed the code into your site, making sure to use your analytics UA [...]

  20. Wow mate – if this works your a genius! Just trying it now.

    Thanks

    Chris Russell

    8 Nov 09 at 16:03

  21. whoopeeee!! it works, you’re great man!!

    kai

    13 Nov 09 at 03:40

  22. thanks for sharing this instruction but doesn’t work for me, I get the “tracking unknown” error and when i go back to see the code in myspace I see that it has been modified and they added strings of code to the original one you posted. What am i doing wrong?

    micio

    17 Nov 09 at 01:36

  23. ok got it to work, I had to put the code on top of the other scripts i already had on the bio part!
    thanks man!

    micio

    17 Nov 09 at 14:44

  24. when I go to google.com/analytics/settings/home?scid=(my code) page … there is an icon says tracking not installed …. what does it mean exactly?

    and do we keep the y from your code UA-XXXXXXXX-Y ?

    the only thing that we have to replace for the code you’ve provided is the UA-code right?

    animal

    17 Nov 09 at 21:08

  25. You rock. Thankyou! I followed your instructions and it worked like a charm. Please let us know if myspaceGA.swf stops being hosted there…or perhaps you could make it available for download so that I can host it somewhere…? Anyways THANKS!

    Evan Holmes

    13 Dec 09 at 10:07

  26. Hiya,

    I pasted the following code and and google analytics still can seem to find it! Please help!!

    GA number: UA-12284165-1
    http://www.myspace.com/renegaderuin

    Phil

    2 Jan 10 at 23:58

  27. Phil, from what you have told I can only recommend checking my comment on 22 Sep 09 at 10:19. Basically you have to wait a bit before the data shows up.

    edzis

    3 Jan 10 at 00:26

  28. It would seem that myspace has won this around
    myspace auto changes the code so it does not work
    by adding allowScriptAccess=”never” & allowNetworking=”internal”
    so this does not work anymore but only for myspace
    I can think of 1000 other websites that I could use this thing on.
    so let me say Tahnks for taking the time to make this well made swf file.

    p.s. e-mail is you come out with any updates
    Thank you ;)

    E-TARD

    21 Jan 10 at 23:07

  29. E-Tard, I checked it out but myspaceGA is still working. It does not rely on any values for allowScriptAccess and allowNetworking.

    edzis

    22 Jan 10 at 16:26

  30. I am having trouble coding this could u possibly help?

    -James

    James N

    26 Jan 10 at 17:43

  31. James, let me know what exactly is your problem and I’ll see then.

    edzis

    26 Jan 10 at 18:10

  32. what code do i put on the myspace

    James N

    26 Jan 10 at 19:28

  33. i have http://www.myspace.com/thebreakdowntbd and cant figure out what the code should be my UA number is UA-12669538-3

    James N

    26 Jan 10 at 19:51

  34. myspace adds allways this code:

    “param name=”allowScriptAccess” value=”never” ”
    “param name=”allowNetworking” value=”internal”

    i guess thats why GA doenst find it.

    is there a work around?

    thanks carsten

    carsten

    6 Feb 10 at 16:03

  35. Hey, nice bit of shoe horning there! I’m new to fancy code and stuff and not sure about what to do with the .swf you mentioned. I’ve posted the code you provided into our ska metal band’s page here: http://www.myspace.com/prinkmusic

    I have just one question. What does the .swf do? Is it a problem linking to yours and where can I host my own (without hosting) as I don’t have any yet.

    Cheers, Terrence

    Terrence PrinK

    9 Feb 10 at 18:45

  36. About 22 hours ago this is what I did (for those who are unclear, here it is step by step):

    1. Downloaded the SWF file, then uploaded this to my web server
    2. Added the myspace code to my myspace
    3. Created a new profile in GA for my myspace
    4. Edited the myspace code by (i) entering the path to the SWF file on my web server, (ii) setting the background colour, entering the UA-XXXXXXX-Y of my GA profile

    Last night: GA registered that it was collecting data, so the setup appears to work.

    It has been 22 hours since then: GA has not reported any visits to myspace.

    It is approaching 24 hours: I will report back to let you know if GA starts reporting visitors.

    Shamans Fire

    24 Feb 10 at 02:22

  37. Its been about 26 hours since I installed the code, and GA is now starting to reporting visitors. So it works! Be patient, give GA as long as 24 hours or more for the first results to up.

    Black Eden Society

    24 Feb 10 at 06:36

  38. Thank you very much! :)

    Daniel

    24 Feb 10 at 19:38

  39. Thanks, Edzis!

    I installed your solution on my blog this morning. Am Awaiting results now.

    PJW for MSW

    Mike

    27 Feb 10 at 13:05

  40. Hi, thanks for sharing this solution.
    I’ve put the code in my profile and it’s working since 3 days. The strange thing is that all the traffic is said to be direct access, is it because of the external flash file?
    Thanks again.

    j

    jkorkou

    5 Mar 10 at 10:00

  41. And also the length of the visit is always 00:00 !
    Thanks.

    j

    jkorkou

    5 Mar 10 at 10:02

  42. jkorkou, I am aware if these limitation but have not had enough motivation to finish exploring the potential solutions. Hopefully one day I will solve this. Until then maybe someone has more insights on this?

    edzis

    5 Mar 10 at 13:42

  43. Thanks edzis, I just wanted to be sure that I wasn’t doing something wrong. Again this is still useful.

    j

    jkorkou

    5 Mar 10 at 13:59

  44. Hey, I came in from Google. I’ve bookmarked, aloha. :)

    default layouts

    7 Mar 10 at 01:47

  45. Hi,
    It doesn’t still work (for 2 weeks) and I don’t know why.
    See “Tracking Status” of my Analytics :
    “Waiting for Data
    Analytics has been successfully installed and data is being gathered now. ”

    Do you have an idea ?

    Thx

    Alex

    8 Mar 10 at 15:19

  46. Alex, No Idea realy, but if you give me the link I could take a look at your myspace page and see how it looks there.

    edzis

    8 Mar 10 at 16:06

Leave a Reply