Hmm, I have searched the internet and can't find a recent reliable
solution. If anyone ever finds one so that SWFObject and Google
Analytics can be friends please let me know. For the sake of sparing a
quick start-up flash on each website I can't afford to spend any more
time on it :(

On Jan 27, 1:02 pm, Philip Hutchison <[email protected]> wrote:
> @aran:
>
> yes, i believe you're right.  i'd ask bobby &/or geoff to confirm.
>
> two observations:
>
> 1. when using the static publishing method, the SWF is in the <body> markup
> already.  this means it doesn't require JavaScript, and it loads before any
> other markup placed at the end of the <body> element. when using static
> publishing, any google code located after the SWF markup but before </body>
> should have no effect on the SWF (except maybe if you're using
> ExternalInterface, which is a whole 'nother discussion).
>
> 2.  the registerObject code doesn't appear to use any onload/domready
> events.  since it's normally placed in the <head>, the javascript in the
> registerObject function should have already executed before <body> starts
> loading.
>
> @saltedherring:
>
> you probably shouldn't use document.write if you're using the domready
> approach.  when using this approach, the google code needs to be slightly
> reformulated.
>
> as i mentioned, many others have worked out exactly how to break down this
> google code and put it in a domready wrapper. try searching the www for
> examples of how others have done it.  it's what i'd do.  :)
>
> - philip
>
> On Mon, Jan 26, 2009 at 3:11 PM, Aran Rhee <[email protected]> wrote:
> >  Philip.
>
> > Thanks for the input / solution.
>
> > Just to clarify for everyone, this is the case only for Dynamic publishing
> > then? (I haven't looked at the src to see if the static publishing
> > registerObject() method waits for the domready event as well)
>
> > Aran
>
> > *From:* [email protected] [mailto:[email protected]] *On
> > Behalf Of *Philip Hutchison
> > *Sent:* Tuesday, 27 January 2009 7:09 AM
> > *To:* [email protected]
> > *Subject:* Re: Added Google Analytics, alternative content flashes on
> > screen
>
> > the biggest 'gotcha' with placing the google code at the end of the <body>
> > element is that the google code gets executed before the page's
> > domready/onload events are triggered.
>
> > this means if you're trying to display a SWF as quickly as possible, the
> > swfobject.embedSWF will not be invoked until AFTER google's code has loaded
> > and executed. your SWF's load time is therefore at the mercy of google's
> > servers.  your alternate content will display until google's code is done
> > executing and swfobject is invoked via its domready/onload methods.
>
> > if you want to avoid having to wait for google's code to execute first, you
> > can wrap it in a domready event.  if you're using a javascript framework
> > such as jQuery, MooTools or dojo, you can usually just write something like
>
> > window.addEvent("domready", function (){
> >   //paste google analytics code here
> > });
>
> > if you don't use a framework, SWFObject has a built-in addEvent method you
> > can use.  it's called addLoadEvent(fn)
> >http://code.google.com/p/swfobject/wiki/api
>
> > You can use it like this:
>
> > swfobject.addLoadEvent(function (){
> >   //paste google analytics code here
> > });
>
> > You can find plenty of examples of people hotrodding the analytics code to
> > work in an domready/onload event, just do a google search.
>
> > good luck
> > - philip
>
> >  On Mon, Jan 26, 2009 at 4:43 AM, Getify Solutions, Inc. <[email protected]>
> > wrote:
>
> > You know, I'll admit, I've had "issues" with GA code as well. Their
> > documentation says to put it at the top of the page, but for page loading
> > reasons, I did exactly as Aran suggests. And everything seems to work fine.
>
> > Well, most everything. Actually, there are a couple of nagging things that
> > don't seem to work correctly, and I'm not sure if it's because of my
> > placement of GA.js or if it's just bugs with GA or problems with how I set
> > it up.
>
> > But anyway, even those nagging problems with GA are non-critical... all the
> > main stuff I need works just fine as Aran suggests.  But yeah, this is a
> > confusing topic to get definitive answers on. Ask 10 people and you'll
> > likely get 10 different opinions.
>
> > --Kyle
>
> > --------------------------------------------------
> > From: "Aran Rhee" <[email protected]>
> > Sent: Monday, January 26, 2009 2:59 AM
> > To: <[email protected]>
> > Subject: RE: Added Google Analytics, alternative content flashes on screen
>
> > > Where is you GA code?
>
> > > The proper place to put all GA includes and code execution is at the very
> > > bottom of the page just before the </body> tag. This way all other code o
> > > the page needed for rendering / display can execute without having to
> > wait
> > > for the response back from the Google servers.
>
> > > Just keep in mind that HTML renders in order as it is loaded...
>
> > > Cheers,
> > > Aran
>
> > > -----Original Message-----
> > > From: [email protected] [mailto:[email protected]] On
> > > Behalf Of saltedherring
> > > Sent: Monday, 26 January 2009 12:17 PM
> > > To: SWFObject
> > > Subject: Added Google Analytics, alternative content flashes on screen
>
> > > Hi,
>
> > > I have SWFObject on one of our sites and since adding Google Analytics
> > > JavaScript code to the page there's now a delay and the alternative no-
> > > flash content shows on screen for a split second (maybe longer on
> > > slower machines). Is there some way around this to keep the
> > > alternative stuff hidden until the page is processed or some other
> > > approach maybe? It must be a common problem?
>
> > > Any help appreciated, thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SWFObject" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/swfobject?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to