Add countUnique and centralize the url parameter mangling code.