Actually, the advice has changed, so my initial method would appear to be correct, although I'm still not seeing the expected results in my reporting.
In my original post I was using the following logic:
if(document.location.href.indexOf("whatever")!=-1){
return false
}
As I'm trying to fire Analytics only where "whatever" is present in the URL, this was slightly incorrect, as the comparison operator should have been == and not !=.
The guidance from customer care is:
You can navigate to Analytics tool (link) in the web property and "Open Editor" from Customize Page Code section (screenshot attached). Therein, you can write a code with the below logic. Please note, I won't be able to share the exact code, however I'll be just sharing the logic that can be converted to the code.
if ("Path" does not contain "servletcontroller")
{
return false;
}
Really scratching my head at this point...