Link to home
Start Free TrialLog in
Avatar of somnamblst
somnamblst

asked on

Track both rollOver & on (release) events with Google Analytics

I am trying to track both a rollover event that has a gotoAndPlay(2)and an on (release) getURL. My Flash movie is transparent and the gotoAndPlay( 2) has expanded content

No matter what I try the rollover event is trying to trigger a getURL. I currently have the following which is trifggering a getURL on rollOver.

box_mc.onRollOver = function():Void
{
getURL("javascript:pageTracker._trackPageview('/flash/rollover/');");
box_mc.gotoAndPlay(2);
myVar = "Flash Track Test";
}
box_mc.onRollOut = function():Void
{
box_mc.gotoAndStop(1);
};
box_mc.onRelease = function():Void
{
 getURL("javascript:pageTracker._trackPageview('/flash/click/');");
 getURL("http://www.yahoo.com","_blank");
};

In an an attempt to separate the real getURL event from the box_mc rollOver events I also tried adding my on (release) getURL to a separate button instance called btnClick. That is not working either, as the box_mc is overlapping my btnClick. I am hoping I can do both, as I really want to be able to track rollOvers.
Avatar of somnamblst
somnamblst

ASKER

Here is a link to my FLA
http://atol.cincinnati.com/widget/rollover_300.fla

Here is my GA code for demo purposes

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-2277416-2");
pageTracker._initData();
pageTracker._trackPageview();
</script>

i downloaded the file and it is empty
That's weird, I just grabbed it from my URL link when I got home. It's 631k
are you using flash cs3 ?


let me clearify that: your problem is that you get the (on release) response when you are just (rolling over) ?

waiting for your response
I need for my SWF to function as it is supposed to, on Rollover it advances to frame2 for the expanded content, on rolloff it goes to frame 1, on release it clicks thru to some URL. I want to track with google analytics the rollover event AND the on (release) event as 2 separtee measurable events.

Extrapolating from the Google Analytics help files I thought I would be able to track with an action of gotoAndPlay(2) the rollover event AND track with action the on (release) getURL click thru to some URL. The unexpected result of the AS I attempted to use was that the rollover triggered a launching of the getURL that belonged to the on (release) event. Subsequent hacks I attempted prevented the on (release) getURL event from occuring.

I am using AS2 and can save back to Flash 8 if that is helpful.
ASKER CERTIFIED SOLUTION
Avatar of Smart_Man
Smart_Man
Flag of Egypt image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Throwing javascript errors in both FF & IE. I can send you the files if you'd like to debug
ok . flash 8
FLA:
http://atol.cincinnati.com/widget/rollover3_300.fla

HTML file with SWF & the Google Analytics js that is required for GA tracking

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>rollover3_300</title>


<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
<script type=text/javascript>
var pageTracker = _gat._getTracker("UA-2277416-2");
pageTracker._initData();
pageTracker._trackPageview();
</script>

</head>
<body bgcolor="#ffffff">

      <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="300" height="274" id="rollover3_300" align="middle">
      <param name="allowScriptAccess" value="sameDomain" />
      <param name="allowFullScreen" value="false" />
      <param name="movie" value="rollover3_300.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" />      <embed src="rollover3_300.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="300" height="274" name="rollover3_300" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
      </object>

</body>
</html>
i discovered the last flash i have is mx.. have benn some time since last time i flashed. getting the newst one to prcess your file

is flash cs3 is what you are using ?

waiting for yoru reply
I am using CS3 and I can only save back to Flash8. Integrating Google Analytics tracking with Flash events is really a combination Actionscript Javascript issue. Are you using the most recent version of the tracking code ga.js vs. the older version called urchin?

http://www.google.com/support/googleanalytics/?hl=en
let us first focus on the action script error.
i guess that will solve the tracking thing and any followed errors.


it will take me some time to get the cs3. to view your example.

here is a usefull EE link . check if the dynamic assign of the events make anychanges with u

waiting for your reply
There is no actionscript error it's throwing a javascript error

Also there is no link in your post
sorry for not pasting the link.

is your problem with the javascript. or with the roll over/ release events ?
The problem that I am trying to solve is, how to track, not just the typical on (release) event in Flash with Google Analytics, but to also track a rollover event. This is not addressed in the Google Analytics documentation examples. My attempts to extrapolate from the GA documentation resulted in unforseen buggy behavior. Moving the on (release) event above the rollover event did prevent the rollover from
triggering a real getURL but also seemed to create a situation that is causing the Flash file to throw JS errors in both IE & FF. That error is pageTracker is not defined.

I am not an actionscript guru so I am unsure how the onEnterFrame example in the GA documentation might apply.
That is my post on actionscript.org
The solution is

box_mc.onMouseDown = function():Void
{
 getURL("javascript:pageTracker._trackPageview('/flash/click/');");
 getURL("http://www.yahoo.com","_blank");
};
box_mc.onRollOver = function():Void
{
 getURL("javascript:pageTracker._trackPageview('/flash/rollover/');");

box_mc.gotoAndPlay(2);
};

box_mc.onRollOut = function():Void
{
      box_mc.gotoAndStop(1);
};

great. please help us fintialize questions.

you can ask for refund or grade the expert helped you /worked with you finding your soltuion. grades start with A :) more or less

waiting for your reply