• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 999
  • Last Modified:

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.
0
somnamblst
Asked:
somnamblst
  • 10
  • 10
1 Solution
 
somnamblstAuthor Commented:
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>

0
 
Smart_ManCommented:
i downloaded the file and it is empty
0
 
somnamblstAuthor Commented:
That's weird, I just grabbed it from my URL link when I got home. It's 631k
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Smart_ManCommented:
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) ?

0
 
Smart_ManCommented:
waiting for your response
0
 
somnamblstAuthor Commented:
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.
0
 
Smart_ManCommented:
now i got the show. sorry if it took you extra lines to explain.
try putting the release fun above the other 2 functions.

i do not really recall the events you have. but is there a down or a click event. which is better than release which may interfere with rollover and roll out

sorry it have benn some time since my great flash projects that is why we need to go through it together rather than just pasting a working code

waiting for your reply
0
 
somnamblstAuthor Commented:
Throwing javascript errors in both FF & IE. I can send you the files if you'd like to debug
0
 
Smart_ManCommented:
ok . flash 8
0
 
somnamblstAuthor Commented:
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>
0
 
Smart_ManCommented:
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
0
 
somnamblstAuthor Commented:
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
0
 
Smart_ManCommented:
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
0
 
somnamblstAuthor Commented:
There is no actionscript error it's throwing a javascript error

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

is your problem with the javascript. or with the roll over/ release events ?
0
 
somnamblstAuthor Commented:
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.
0
 
Smart_ManCommented:
0
 
somnamblstAuthor Commented:
That is my post on actionscript.org
0
 
somnamblstAuthor Commented:
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);
};

0
 
Smart_ManCommented:
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
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 10
  • 10
Tackle projects and never again get stuck behind a technical roadblock.
Join Now