The parts of a URL
A URL packs several pieces of information into one string: scheme://user:password@hostname:port/path?query#fragment. Most are optional, which is what makes URLs awkward to pick apart by eye when something is not behaving as expected.
One piece never reaches the server: the fragment, everything after #. It is handled entirely by the browser, which is why an analytics tool that reads the fragment has to run client-side.
Debugging query strings
Query strings are where most URL problems live. A value containing an unescaped & splits into two parameters and truncates the data. A value containing an unescaped # turns the rest of the URL into a fragment and never reaches the server at all. Seeing the parsed parameters listed separately makes both failures obvious.
Campaign tracking is the common case: utm_source, utm_medium and utm_campaign have to survive every redirect between the ad and the landing page, and a redirect that drops the query string is a frequent cause of traffic appearing as direct.
To escape a value correctly before building a URL, use the URL encoder. To inspect the headers of the resulting request, use the HTTP header parser.