A complete URL can contain a path, query and fragment. Campaign pairs belong in the query before the fragment; placing them after # changes fragment text rather than the request query.

Preserve what UTMLink does not own

A destination may already carry a language, product filter, affiliate code or bare feature flag. UTMLink removes only the six exact lower-case campaign names it owns. Every other raw segment stays in source order with its original percent escapes, duplicate status and equals-sign shape. This narrow rule avoids a whole-query serialization pass that could turn an existing %20 into + or otherwise make an unrelated textual change.

Encode only new values

New campaign values use the browser form-query profile: a space becomes +, a literal plus becomes %2B, and Unicode becomes uppercase UTF-8 percent bytes. Ampersand and equals are encoded inside a value so they cannot create an accidental pair. The original fragment, including its # marker and spelling, is appended after the rebuilt query. These are syntax rules, not evidence that the destination will accept or retain every value.

A practical review before publishing

Read the final address from the destination through the last fragment character. Confirm that the host and path still identify the intended public page, that unrelated filters or product identifiers remain present, and that every campaign value follows the naming sheet used by your team. Copy the link into a plain-text editor before placing it in an email, advertisement or document so rich-text software cannot hide a changed character. Open it only when you are ready to visit the destination, then check the browser address bar and the analytics implementation separately. A syntactically well-built link cannot prove that a page exists, that redirects preserve its query, or that an analytics property attributes the visit as expected.