Why does my analytics drop query strings such as ?ref= and ?q=?

PostDeploy keeps only utm_source and utm_campaign. The script removes every other query parameter, the fragment and the referrer's path in the browser, before anything is sent. Those parts of a URL can carry search terms, email addresses or tokens. Tag your own links with utm_source instead of ref, and count searches with a goal.

Last updated 26 November 2026. By Paul Badarau.

A fictional newsletter links to a bike shop's site as /lights?ref=newsletter&color=red. The shop's Pages report shows one row, /lights. A visitor who searches the shop for "rear light" lands on /search?q=rear+light, and the report shows /search. Neither the ref value nor the search words reach PostDeploy.

The script cleans every address before it sends a pageview:

  • It keeps the path, plus utm_source and utm_campaign when they are present. Each kept value is cut to 100 characters.
  • It removes every other query parameter, including ref, q, utm_medium, utm_term and utm_content.
  • It removes the fragment, so /docs#install and /docs#faq are both /docs.
  • It keeps only the host of the referring page, never its path.

Because this happens in the browser, the removed parts never reach the server. There is nothing to recover later, and no setting keeps an extra parameter.

What to do instead:

  • Tag links you control with utm_source, such as ?utm_source=newsletter&utm_campaign=november. If you used utm_medium or utm_content to tell two links apart, put that detail into the campaign value, such as november-footer.
  • For links other people add with ?ref=, rely on the referrer. PostDeploy stores the referring host, so the visit is still credited to that site when the browser sends a referrer.
  • To count site searches, add a page goal for /search. Page goals need no code. To count searches that found nothing, add a named event goal called search_no_results and call postdeploy.track('search_no_results') when the results list is empty.
  • If two versions of a page must be counted apart, give them different paths, such as /product/42, instead of /product?id=42.

The limit people miss is the router. A single-page app that changes only the fragment, as in /#/pricing, records one page for the whole visit. Use path-based routes if you want each screen in the Pages report.

The product page for this is Analytics.

Start your 14-day free trial