I've been searching around the internet for a while to store a click counter within a flash video. Basically count how many times a video was actually viewed instead of the page being loaded.
I have a few restrictions. :(
- I cannot use a server side language.
- I cannot 开发者_运维百科use a database. (I want to use a text file stored on the server)
Is this even possible?
There is a simple and effective solution : Google analytics API.
Get an analytics account, and you can track videos clicks and much more, with beautiful graphs.
You can create dynamic stats from javascript or from flash, see this example.
If you use flowplayer, just hook to their API to track play, pause or any event.
Anyway you need a server side language to edit this text file.
and after you have to choices:
- Rewrite a video player, so every time user click play button it send a call to server script which update counter.
- use placeholder image instead of the video player, and after user click on it, make an ajax call to server which call update counter, and return an embed code for the video player.
update.
you can play with google analytics and some custom variables in the links to the video specific video, i think it could be even better than text file
精彩评论