This article will introduce how to remove Query String in GA4
Issue
If there are many query parameters on the URL, it will cause many lines to be displayed on the same page, which is not intuitive:
The solution is to remove the Query String.
Currently GA4 does not support removing Query String, but it can be done in GTM.
Configuration
Suppose now to remove the fbclid parameter.
There is a variable template called Trim Query in GTM, we can use it to remove Query String.
Variables
First add the Trim Query variable template.
In GTM, click「Templates」——「Search Gallery」in Variable Templates, and search for “Trim Query“:
Click to add it to Workspace, the final effect:
The second step is to create a Trim Query variable and remove the Query String.
In GTM, click「Variables」——「New」——「Choose a variable type to begin setup…」——「Trim Query」,Then name it “Page URL (Remove Query String)” and make the following settings:
Tags
The next step is to adjust the tags of GA4‘s, open the tags of GA4‘s, and cover page_location with “Page URL (Remove Query String)”:
Preview
The last step is to preview and debug.
Click 「Preview」in GTM:
Enter https://www.bbccss.com?fbclid=PAAaYWoW in Tag Assistant:
Uncheck “Include debug signal in the URL” and click “Connect”.
Enter the test state and return to Tag Assistant,Click 「Container Loaded」, then click GA4’s Tag, click 「value」 in the upper right corner
page_location is no fbclid parameter.
You can also check it in DebugView in GA4:
page_location is no fbclid parameter.
Indicates that the configuration is successful.
Summary
This setting is set on GTM, because the data cannot be traced back, please make sure that you really do not need this Query String before setting it.