Query Parameter For Inline Report Filters

July 23, 2009
By Robbin Steif,
President, LunaMetrics

The filter at the bottom of the reports can be quite handy. But you may have noticed that (like lots of AJAX-y things on the web these days) the URL doesn’t change when you apply this filter.

inline-filter

This can be a pain when you want to bookmark it or share the filtered report with someone else. (Sure, you can email them the report, but the static output isn’t the same as letting them play with it live.)

So you may be interested to know that you can actually apply the filter with a query parameter in the URL. (This may be of interest to anyone who’s writing Greasemonkey scripts or something like that, as well.)

The query parameter is q and you can use whatever expression you would use in the regular filter box. (Just make sure you URL-escape any characters that aren’t safe in URLs.) There’s also a query parameter qtype that specifies the value of the “containing” or “excluding” dropdown. Set qtype=0 for a “containing” filter and qtype=1 for an “excluding” filter. Just add these parameters to the URL for the report that you already have, and voila! you have a filtered report.