Skip to main content

AltF Flow recipe

Add UTM parameters to a list of URLs

To tag many links for one campaign, clean the list first, then append the same UTM string to each line. This recipe trims each line, drops blanks, removes any existing query string or #fragment, dedupes, and adds utm_source, utm_medium and utm_campaign to every URL so analytics groups the clicks together.

  • Free, no sign-up
  • Runs in your browser
  • Nothing uploaded
  • Share recipes as a link

5 steps · runs in your browser · nothing uploaded

Pipeline

  1. Remove leading and trailing spaces from each line.

    6 → 6 lines
  2. Remove all

    6 → 5 lines (-1)
  3. Find: [?#].*$, Regular expression

    5 → 5 lines
  4. Keep the first copy of each line and drop repeats.

    5 → 4 lines (-1)
  5. Suffix: ?utm_source=newsletter&utm_medium=email&utm_campaign=november

    4 → 4 lines

6lines5words227chars

4lines4words392chars-2 lines vs input

The 5 steps in this recipe

  1. 1

    Trim every line

    Remove leading and trailing spaces from each line.

  2. 2

    Remove empty lines - Remove all

    Delete blank lines, or squeeze runs of blank lines down to one so paragraphs stay apart.

  3. 3

    Find and replace - Find: [?#].*$, Regular expression

    Replace text everywhere. Supports regular expressions with $1 back-references.

  4. 4

    Remove duplicate lines

    Keep the first copy of each line and drop repeats.

  5. 5

    Add prefix / suffix - Suffix: ?utm_source=newsletter&utm_medium=email&utm_campaign=november

    Add text before and after every line, or around the whole result.

Change any option in the workspace above, switch a step off to compare, or add your own steps. Save it to reuse it, or share the recipe as a link.

Worked example

Before
https://www.example.com/pricing
  https://www.example.com/blog/spring-guide?ref=old-campaign

https://shop.example.org/products/blue-mug#reviews
https://www.example.com/pricing
https://www.example.com/contact?utm_source=twitter
After
https://www.example.com/pricing?utm_source=newsletter&utm_medium=email&utm_campaign=november
https://www.example.com/blog/spring-guide?utm_source=newsletter&utm_medium=email&utm_campaign=november
https://shop.example.org/products/blue-mug?utm_source=newsletter&utm_medium=email&utm_campaign=november
https://www.example.com/contact?utm_source=newsletter&utm_medium=email&utm_campaign=november

Why strip the existing query string

Appending ?utm_source=... to a URL that already has a ? produces an invalid second query string. The regex [?#].*$ removes everything from the first ? or # to the end of each line, so old tracking tags and anchors are cleared before the new tags go on. It also makes two copies of a page with different old tags identical, which is why dedupe runs after it.

When not to strip

If some URLs need their own parameters, such as ?product=42, delete step 3 and change the suffix to start with & on those lines instead, or split the list and run two recipes. Edit the suffix text to change the source, medium and campaign values; keep them lowercase so reports do not split one campaign into two.

Add UTM tags to URLs: questions and answers

Can I use a different tag per URL?

Not with this recipe; it adds the same suffix to every line. For per-link values, use a line template with {n} or {slug}, for example &utm_content={slug}.

Are the parameter values URL-encoded?

The suffix is added exactly as typed. Use lowercase letters, numbers and hyphens in values so no encoding is needed.

What if I only want to remove tracking tags?

Use a dedicated tracking parameter stripper, which removes known tracking keys and keeps the others.

More recipes like this

Every step you can add (41)

Clean up

  • Trim whitespace
  • Trim every line
  • Remove empty lines
  • Collapse repeated spaces
  • Remove line breaks
  • Strip HTML tags
  • Straighten smart quotes
  • Remove accents
  • Remove punctuation
  • Remove emoji
  • Remove non-ASCII characters

Change case

  • Change case
  • Make URL slugs

Lines

  • Sort lines
  • Remove duplicate lines
  • Keep only duplicated lines
  • Compare with another list
  • Count repeated lines
  • Reverse line order
  • Shuffle lines
  • Keep a range of lines
  • Truncate long lines
  • Wrap at a width
  • Split into lines
  • Join lines

Find and filter

  • Find and replace
  • Filter lines
  • Remove words or characters

Extract

  • Extract

Data and formats

  • Format JSON
  • Minify JSON
  • CSV to JSON
  • JSON to CSV
  • Lines to JSON array
  • JSON array to lines

Encode and decode

  • Encode or decode

Build output

  • Add prefix / suffix
  • Quote each line
  • Number lines
  • Apply a line template
  • Add timestamp
What each step does, with its options

AltF Flow runs entirely in your browser. Your text is never sent to AltFTool; saved recipes stay in this browser and shared links carry the steps only.