url_with_ref, a tiny Ruby gem
Made a new Ruby gem: url_with_ref
It’s a foolproof way of generating ?ref=foobar style tracking URLs. It’s smart enough not to override existing ref parameters and automatically uses & in case of existing parameters.

The code is pretty simple. If you don’t want another dependency, feel free to just copy/paste the source code into your app.
The reason I made it into a gem is because I use the functionality across different products and try to avoid duplication.
Get early access to what I build next
Plus personal notes I don't share on X. I rarely email, so each one counts.