The logic in this function is hard to follow. Would something like this work?

```
if (href.indexOf('mobile=true') > 0) {
  return href.replace('mobile=true', 'mobile=false');
} else if (href.indexOf('mobile=false') > 0) {
  return href.replace('mobile=false', 'mobile=true');
} else {
  return href + '&mobile=' + (device === 'desktop' ? 'true' : 'false');
}
```

I'd rather extend gaUrlUtils here to detect current mobile flag in url and then just overwrite with the opposite. That's probably something for a regexpt specialist.