dubinc / dub

Open-source link management infrastructure. Loved by modern marketing teams like Vercel, Raycast, and Perplexity.
https://dub.co
GNU Affero General Public License v3.0
19.01k stars 2.06k forks source link

Link Aliases (Instead of Internal Redirects) & Filtering Stats by Alias #495

Open abass opened 11 months ago

abass commented 11 months ago

What we find ourselves doing often is creating an new short link, and directing it to an existing link, and then marking it as "internal redirect". We may for example have a "sponsorship" document link to a Slite page (e.g. Notion), but not want to give the main short link to those who we are sending it out to. So what we do is create that alias (internal redirect separate link) and then give that new link to the potential sponsor. It's great too because we can see if they clicked it, how engaged they are, and if they shared it with the rest of the team. But now we have 5 separate links, all internal redirects to a central Dub link, and well it's overwhelming to manage. In reflecting on this, all we really need here is a link alias. e.g. allow us to go to a link and spin up additional aliases, which add stats to the existing link, and allows you to essentially "filter" down by each alias. It'd essentially be like grouping links together, but way cleaner and far easier. Maybe would be nice to have a separate comment, or heck we can just log notes in the parent link comment section. We'd just love to have this before we end up further creating a mess with tons of links, linking to the same link, and also essentially triggering 2 internal Dub links (2x redirects) for these internal redirect links, because we do want this data aggregated to the main short link. Hope this makes sense, it would be such a huge unlock for us 🥹

steven-tey commented 11 months ago

Love this idea!! Another use case – generate link aliases automatically for an "alias" short domain: https://twitter.com/rauchg/status/1739397052512219491

Some quick thoughts on how this would work with our tech stack:

  1. Add a alias column in MySQL that marks a link as an alias (connect to another link's ID)
  2. Add an alias attribute in Redis that stores the domain, key and id of the original link
  3. When ingesting click events into Tinybird, log events under the original link and enter the alias link under a new alias column.
  4. Related to #501 – have another tab for "Top Aliases" along with "Top Destination URLs"
abass commented 10 months ago

@steven-tey one quick update on this, the more we are doing external blog posts, I'm realizing that we're still linking the entire link and UTM data in the guest blog post because link shorteners actually don't handle this in a solid way. Link aliases COULD solve this, but realizing the one fatal flaw... Are you going to allow for UTM overrides in the link alias? e.g. I'm writing a blog post and will be linking to the following: https://efficient.app/?ref=dashlane&utm_source=dashlane&utm_medium=blog&utm_campaign=saas+questions+answers

That's horribly ugly, so okay, what's happening here? We're linking to the homepage. Okay great, so let's create a short link that just links to our homepage (the parent URL doesn't really matter because it's just meant to be a template of sorts): efficient.links/homehttps://efficient.app/ ?ref=efficient.link

Perfect! Now let's create a link alias, tying it to the partner's blog: efficient.links/go/acirestn — this is the link that we'll put on the partner's blog... BUT all of the UTM data is stored on the destination of the original link. Oh no! An alias really needs the ability to push over and overwrite the UTM data to make it useful in this case.

efficient.links/go/acirestn should be able to output this UTM data ?ref=dashlane&utm_source=dashlane&utm_medium=blog&utm_campaign=saas+questions+answers overriding any other conflicting UTM data that's written.

The magic with this solution is that we can actually use short links on blog posts, more thinking it programmatically of "let me see all of the link aliases that are sending over to our homepage, and you can keep that as a parent grouping of sorts. Say you change the page to now be efficient.app/home, you can just update it in the one parent of the link aliases and all of the link aliases will be updated. Otherwise, you'd have to update say 50 links manually to change it from efficient.app to efficient.app/home

Curious if that connects at all? Writing a guest blog post now and was reflecting on why we never actually use short links and always just link back directly (which is a pain and leads issues when sending over all the UTM information, hoping they copy it correctly).