View Full Version : Tracking Flash Embeds
maninderv
03-09-2007, 03:35 PM
Hello Everyone,
I need some guidance on how can one track flash embeds.
Like for example, if from my site, users can copy the embed tag and paste it in their blogs/myspace/etc. I want to be able to track the unique visitors, screen resolutions, browsers, page impressions, etc.
I use google analytics on my website, but I could not get it to work with it.
So, I thought I will write some action script inside of my flash movie and detect certain things about the computer on which the embedded movie is being rendered and send a request to a servlet on my server.
So far so good.
Now how do I detect those things?
I used the Sytem.capabilities class to get the screen resolution, os, flash version, etc and that was good. Now, I need to send back the referral information as well (ie the domain name of the site on which the widget is embedded, for example myspace or blogger.com).
How can flash find out the domain name?
The local connection is capable of getting the domain of where the flash movie is located but no where it is embedded. So, I need to be able to capture the domain from within flash.
I don't external interface call as myspace will stop that anyway.
Please let me know if you guys have a solution to this or better ideas or even better if you made it work with google analytics.
Thanks,
Mandy.
Emancipator
07-11-2007, 08:50 PM
Mandy I am in the same boat as you. I need to be able to access the domain where my code is embedded. I would also LOVE to hear how its done as well! I can say for sure that _url doesnt work :)
dzedward
07-12-2007, 07:22 PM
check out Statcounter (http://www.statcounter.com)
Emancipator
07-12-2007, 08:16 PM
i appreciate your response. I already have all my stats collection in flash completed, and it passes it to php i just cant get the URL of where the code is embedded. Is there no method of doing it with flash? Tks again for the help!
dzedward
07-12-2007, 08:28 PM
so if someone copies your embed tag, and embeds it into their own web page, you want to know where it is happening? i would say a collaboration between javascript and flash would be needed.. i believe javascript can capture the url, then it would pass that along to flash, then you could have flash send it to you with server side scripting. but i dont believe flash can collect a url on its own.
Emancipator
07-12-2007, 08:38 PM
so if someone copies your embed tag, and embeds it into their own web page, you want to know where it is happening? i would say a collaboration between javascript and flash would be needed.. i believe javascript can capture the url, then it would pass that along to flash, then you could have flash send it to you with server side scripting. but i dont believe flash can collect a url on its own.
First off another big thank you for helping me. A friend suggested javascript to capture the url I am just not sure how to do that. My flash embed doesnt have any javscript but i am doing a callback to a php file when they hit PLAY. If your able to show me some sample code you are thinking that would be fantastic.
When a person presses play, my flash player sends a call to a statistics.php file and tracks that it was played, and how much of the video was watched, and this is where i want to add in the domain info as well. So i can see who is using it.
I hate to seem so green, but well I am. :) Appreciate all the help!
dzedward
07-12-2007, 08:46 PM
so the person must be on your website to watch this video? then the domain would simply be yours..
Emancipator
07-12-2007, 08:54 PM
sorry to muddle the waters. Your exactly clear on what i wanted to do. They embed it on THEIR site, and i just want to check the domain. :) Sorry for confusing things. I tried _root.url which was recomended on this site and it does a great job at getting the host of the SWF which is me.
I want the place where its embedded just like you thought. Hopefully you can put me on the path to how to do it.
dzedward
07-12-2007, 09:10 PM
i dont know javascript very well, so you'll have to come up with the function to get the URL, then pass that URL to a param in your embed/object tags <param name="FlashVars" value="URL=javascript variable"> then collect that in flash using _level0.URL i beleive that should do the trick.. but the hard part will be the javascript, i think, but it could be simple, i just dont know it..
Emancipator
07-12-2007, 09:17 PM
i dont know javascript very well, so you'll have to come up with the function to get the URL, then pass that URL to a param in your embed/object tags <param name="FlashVars" value="URL=javascript variable"> then collect that in flash using _level0.URL i beleive that should do the trick.. but the hard part will be the javascript, i think, but it could be simple, i just dont know it..
your a great help thanks again for responding. This has really frustrated me for the last 5 days trying to find an answer.
See the part i cant figure out is how do i get javascript to run on somebody elses site. Right now ive kept all my vars in my player just like youtube, no flashvars that are set in the html.
I definitely have a callback php file im just not sure if i would put the javscript in there, or for that matter how lol.
dzedward
07-12-2007, 09:24 PM
yes, that is what is troubling me as well, since someone can just copy your code, it would be hard to know if they actually copied the JS. which is why it is somewhat flaud. I cant think of another way though.. there is no AS that will collect the URL it is on, withouth some JS and FlashVars.
Emancipator
07-12-2007, 09:49 PM
i wonder how does youtube do it. They dont have any jscript being copied or flashvars. I am glad this isnt something cut and dry and easy, I dont feel so lame having struggled with this for so long.
Hopefully somebody here like yourself will have a moment of genius and can help me out.
dzedward
07-12-2007, 10:05 PM
you know that they track where the file is being played from?
Emancipator
07-13-2007, 03:38 AM
i assume as much based on the info displayed on their site.That said perhaps they are only tracking clickthroughs. Frankly if I can figure out how to do clickthroughs I am sure it could be expanded.
All i know is i have a callback function that goes to a php file the SECOND they hit play. All I gotta figure out is how to get that to capture the url. So it goes
Flash Embed -> Person hits Play -> Callback to PHP file -> insert into SQL
could I somhow put some jscript into my php file that would do it? Thanks again for your feedback.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.