If you use google analytics and you also develop in flash, you’ll be asked to track flash clicks. It can be done using a component and action script 3.

What you need:

Step one:

Close Flash and Download and unzip  the components. Follow the install directions in the readme file. After the component is installed, launch Flash.

Determine what you are going to track.

after you download and install the component.

Open your components (command + F7)

Drag them to your library

Drag the analyticsLibrary to your stage. It doesn’t matter where. I created a new layer, call it GA Library and put it on that layer, than locked it.

Open your actions panel and add the following:

Here is what you should add to frame 1 of the actions layer:

import com.google.analytics.AnalyticsTracker;
import com.google.analytics.GATracker;
var tracker:AnalyticsTracker = new GATracker( this, "UA-111-222", "AS3", true );

The Code:
Add your own GA account number so the data is sent to the correct profiles. Simply change the UA-111-222 to your ID.

To see that the tracker is working I set the last parameter to true. That sets the debug mode. When true, you will see a trace of all tracking events occurring. When false, this will not be visible. Make sure to set it to false when you are ready to publish your file.

Call the AS3 code

I am doing a simple get url button, and would like to track who clicks the button. I gave my button that I want to track an instance name of  “bt1”.

in my actions on frame 1, I have the following code.
//import the Analytics classes
import com.google.analytics.AnalyticsTracker;
import com.google.analytics.GATracker;
//change the number, depending on what site you are tracking.
var tracker:AnalyticsTracker = new GATracker( this, "UA-12453037-5", "AS3", true );

//attaching mouse events to the button on stage
bt1.useHandCursor = true;
bt1.buttonMode = true;
bt1.addEventListener(MouseEvent.ROLL_OVER, overHandler1);
bt1.addEventListener(MouseEvent.ROLL_OUT, outHandler1);

bt1.addEventListener (MouseEvent.CLICK,onClick);

function onClick (event:MouseEvent):void
//make your clients happy.
//use 'event.target.name' instead of 'event.target'
//this will display 'bt1' instead of [object bt1], which is obviously a nicer output.
var bt1:String = event.target.name;
tracker.trackPageview("Funds and Performance landing button");

function overHandler1(event:MouseEvent) {

function outHandler1(event:MouseEvent) {

function onMouseClick(e:MouseEvent):void
var request:URLRequest = new URLRequest("/Lifeline/Product+Information/VUL/vul_case_studies.html");

navigateToURL(request, "_self");

Some of the info in this post came from this site.