0

I want to have an onClick event on flashObjects to fire the google analytics event tracking for every click on Flash. What is the best way to accomplish this?

I don't have access to Flash source code that's why I want to do it with Javascript event.

edit: I found a workaround for this, don't know if its the right way though

<div onClick="_gaq.push(['_trackEvent','CommerceAd', 'IMAGE2000 Click', 'HomePage - Primary', 'sandybridge-horizon-banner']);">
  <object type="application/x-shockwave-flash" data="/BannerImages/1103/sandybridge-horizon-banner.swf" width="98%" height="120">
    <param name="movie" value="/BannerImages/1103/sandybridge-horizon-banner.swf"/>
    <param name="flashvars" value="clickTAG=/some-url.html"/> 
    <param name="wmode" value="transparent" />
  </object>
</div>

1 Answer 1

1

There is no need to use Javascript if you want Google Analytics within Flash. There is library for that:

http://code.google.com/intl/sk/apis/analytics/docs/tracking/flashTrackingIntro.html

I've done it many times using it and it works perfectly.

playGame.addEventListener( MouseEvent.CLICK, onButtonClick ); 
function onButtonClick( event:Event ):void 
{     
  tracker.trackPageview( "/started-game");
  //if user started game you'll see it as an access of subpage "/started-game" in your Analytics account

} 
Sign up to request clarification or add additional context in comments.

2 Comments

I don't have access to flash source code thats why I want to do it with javascript event
Probably the only solution is to overlay the Flash with some transparent HTML object (such as z-indexed DIV) and put Javascript on it. Your Flash will unfortunately stop to receive clicks (MouseEvents). :/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.