In this blog post, you will learn to remove URL parameters from a column that contains page path URLs. We do this by using the REGEXP_REPLACE function that is available in Tableau.
What are URL Parameters? Url Parameters or query strings are added in the back of we web address. They parameters start with a question mark and are separated by and ampersand (&). Here’s an example from Reddit. This URL leads to a specific story on reddit regarding “town hall” that is trending.
Query strings are a quick and dirty way to pass parameters from one page to another. It’s mainly used for passing non-sensitive information. Seeing a password in a URL would be a red flag.
If you want to aggregate data by page URL in Tableau and you haven’t excluded it in Google Analytics (for example), you’ll run into troubles. That’s why we would like to go from this…
We can do that by creating a calculated field and use a formula to strip the URL parameters from a page path. Go to the data source and right click the column header of the column you’d like to edit.
Use the following formula and click apply. Don’t forget to replace the field of your URL column, if it’s not called pagePath.
Now you’ll have a column that has the same URLs, but without URL parameters. This will allow you to aggregate across base URLs.