The problem in hand
Let’s take an example of a single URL to help you understand the actual problem. For example, we have a URL that is
https://marketlytics.com/analytics-faq/exclude-url-query-parameters
Someone lands on our analytics-faq page and enters the term “query parameters” into the search bar. He clicks on the listed options and opens the relevant page. But this time the URL would be
https://marketlytics.com/analytics-faq/exclude-url-query-parameters?rq=query%20parameter
The query string got attached to the URL.
Now, Google Analytics (UA) will detect a unique pageview for this URL. So instead of displaying a single URL, Google Analytics displays two unique pageviews and you will see both the URLs listed in the reports.
Unlike Universal Analytics (UA), where we had to manually remove query parameters from the reports for to avoid duplications, we can easily cater this problem in Google Analytics 4 (GA4) using Page Path Dimension which automatically excludes the query params for us