-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add UTM parameter support for shortened links #997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,30 @@ | ||||||||||||||||||||||
| async function up(knex) { | ||||||||||||||||||||||
| const hasUtmSource = await knex.schema.hasColumn("links", "utm_source"); | ||||||||||||||||||||||
| if (!hasUtmSource) { | ||||||||||||||||||||||
| await knex.schema.alterTable("links", table => { | ||||||||||||||||||||||
| table.string("utm_source"); | ||||||||||||||||||||||
| table.string("utm_medium"); | ||||||||||||||||||||||
| table.string("utm_campaign"); | ||||||||||||||||||||||
| table.string("utm_term"); | ||||||||||||||||||||||
| table.string("utm_content"); | ||||||||||||||||||||||
|
Comment on lines
+5
to
+9
|
||||||||||||||||||||||
| table.string("utm_source"); | |
| table.string("utm_medium"); | |
| table.string("utm_campaign"); | |
| table.string("utm_term"); | |
| table.string("utm_content"); | |
| table.string("utm_source", 255); | |
| table.string("utm_medium", 255); | |
| table.string("utm_campaign", 255); | |
| table.string("utm_term", 255); | |
| table.string("utm_content", 255); |
Copilot
AI
Mar 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Migration file formatting is inconsistent with other migrations: module.exports typically ends with }; (see e.g. server/migrations/20250106070444_remove_cooldown.js). Consider adding the trailing semicolon here for consistency.
| } | |
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reusemode currently looks up an existing link by{ target, user_id, domain_id }only. With UTM fields now affecting the final redirect URL, this can return an existing link whose stored UTM parameters differ from the ones submitted, so the response/redirect won’t reflect the requested UTM values. Consider including the UTM fields in the reuse lookup (or disabling reuse when any UTM field is present) so “reuse” only triggers when the redirect behavior would be identical.