I’m evaluating mint as a stats solution. Must say I’m a bit confused that the FAQ says, no flash tracking, and the forum doesn’t cover asynchronous web-apps that much.
I’ve checked the flashtracker plug but I don’t like the fact that this has it’s own structure/database for something that Mint already does so good. Logging urls/paths/pages..!
For instance on a flash site, why not just call the mint server directly building paths that would correspond to the structure of your flash-site.
/flashstats/init
/flashstats/section/games
/flashstats/section/hiscore
etc..
From what I can see, there are many ways of doing this from flash or from a so called “ajax”-based site. (Note! code = ruff sketch.)
Option 1
[in flash]
getUrl(javascript:store_mint('flashstats/init'));
[in html page that embeds the .swf]
function store_mint(path) {
/*
would have been nice to grab the mint path from the
mint.js but we cant since its a local variable...
*/
var path = 'mint/?record&key='; // whats this key all bout?
var img = new Image();
img.src = path+'&serve_img';
}
Option 2
[in flash]
var mint_url = 'mint/?record&';
// "WIN 8,0,0,0"
mint_url += '&flashVersion='+System.capabilities.version;
// "argument" = section/games
mint_url += '&/flashstats/' + argument;
// wrap this up in nice class etc...
var result = new LoadVars();
var send = new LoadVars();
send.sendAndLoad(mint_url, result, "GET");
I haven’t looked how mint stores and presents the query-data, it would just be lot’s of overhead sending the same info as already generated by the html page for every call.. Don’t know how this would affect average-stats etc.
Option 3 (probably the cleanest way!)
A simple suggestion that I think could support all this.
In “mint/?js”, remove the line
Mint.save();
Move it to the line after the js include in the html output
(script src="/mint/?js" type="text/javascript")(/script)
(script type="text/javascript")
Mint.save();
(/script)
add an optional path argument to the Mint.save method that simply overrides document.URL !
(and maybe second arg for .title or why not any argument, like flashVersion is better sent from the .swf than letting the browser try to grab it…)
Mint.save('called_from_flash/custom/path/here');
This way a flash or async ajax site could just call this method when required.
I’ve seen people asking for, how do I track mp3’s and flv’s etc. With the above solution, Just
// flash
var video_url = 'media/flv/video123.flv';
getUrl('javascript:Mint.save('video_url');');
YourFlashvideoplayer.load(video_url);
ouch, any opinions?