Philip- That looks really good. I'm sure this is gonna be really useful going forward as a great FAQ item and help to people.
I have a question... have you tested what happens if this code *runs* after the page was already loaded and running? In other words, does your code block's logic work the same if someone chooses to embed their swf (and also initiate the google tracking) not DURING page load, but sometime well after it? The use case I'm thinking of is where a set of code (such as yours) is dynamically added to a page at some later run-time point, where the page's "onload" (and indeed any domload's) have certainly already fired. This is a common thing for CMS's and other such systems to defer and run/add javascript to pages on-the-fly. What I'm mostly wondering is, does the logic of detecting a script-tag completion in the way that you do work in that use case? At one time I had toyed with trying to directly detect script tag loading completion like that and had some trouble if the script tags were added to a page after its normal onload/domready's had passed. But perhaps I was just doing it wrong! I just wanted to see if you've tested it in that way, because perhaps it's a case we might want to consider if not. And if it *does* work, then I'm excited because I can update (and simplify) some of my own code using that technique! Thanks again for this script block. I'm sure it'll be very useful and helpful! --Kyle From: Philip Hutchison Sent: Monday, February 09, 2009 2:46 AM To: SWFObject Subject: SWFObject & Google Analytics Just an FYI: I've written some code that enables SWFObject users to move the Google Analytics code out of their markup and place it in a domready event where it belongs. This may help some users with their SWF load time (removing the analytics code from the markup means dynamically embedded SWFs won't have to wait for the Google code to load first). You can read the write-up and see an example here: http://pipwerks.com/lab/swfobject/google-analytics/index.html Comments/suggestion welcome. - philip --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
