Login to download the latest version of Mint and your favorite Pepper, purchase additional licenses, or post in the Forum. Don't have an account? Create one!

In Partnership with Media Temple

Mint Forum

Some thoughts on Tracking from Flash, Ajax etc.

Posted on Mar 18, '07 at 10:56 am

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.


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]

[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


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")

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…)


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';

ouch, any opinions?

Posted on Mar 22, '07 at 09:29 pm

Well, if I understand you correctly, you want to track a flash-only site. Flash doesn’t lend itself well to that sort of statistics tracking. (You might want to look into Actionscript/Javascript interaction).

Tracking an XHR-based site, on the other hand, shouldn’t be very difficult at all. As you said, simply remove the Mint.save() and place it after you load your content.

Posted on May 14, '07 at 08:39 am

Moving Mint.save() after the content being loaded by XHR does not work for us, as Mint always uses the current URL (which doesn’t change when doing only an ajax request) and the page title to distinguish pages. We tried changing the title using javascript and then calling Mint.save() (all after doing the ajax request) but Mint simply uses the title from the time the page was loaded first (and mint’s js was loaded) to log those requests.

Is there any other way to do this? What would we need to change in Mint.save() in order to log a custom url and/or title parameter (as suggested above)?

You must be logged in to reply. Login above or create an account

Hey there, I have officially suspended sales and support of Mint. The Create Account, Add License, Transfer License, and Contact forms have been disabled. Existing customers may continue to login and download Mint.

More info Continue