documentcloud/backbone — Issue #891: Query parameters are confusing the router
Author: martynsmith
Created: 2012-01-25 21:10:06+00:00
State: open

It is not currently possible to use Google Analytics with backbone controlled
routes, as the backbone router does not understand query parameters. If I have
the routes:

```javascript
routes: {
"": "index",
":username": "profile",
}
```

then try to route to `martyn?utm_source=google&utm_medium=ppc&utm_term=testingTimes&utm_content=BIGTEXTVERSION&utm_campaign=OpenTok`
, the profile route fires but the username passed is `martyn?utm_source=google&utm_medium=ppc&utm_term=testingTimes&utm_content=BIGTEXTVERSION&utm_campaign=OpenTok` rather then `martyn`.

I saw the discussion on #668. I don't need query parameter support per se, but
it would be nice if backbone could be told to ignore query parameters.

For now I've done (in my own code):

```javascript
(function(old) {
Backbone.History.prototype.getFragment = function() {
return old.apply(this, arguments).replace(/\?.*/, '');
};
})(Backbone.History.prototype.getFragment);
```