Trigger on the change of a specific URL part (query parameter)

I would like to create a trigger that fires if a certain part of the URL (a query parameter) changes. It is the same problem as u/itsJ92 had a year ago, but they didn't get a helpful answer. So I will try to explain it better:

The website is an interactive map. The map can be moved, objects can be filtered and selected, etc. The current state of the map is reflected in the URL. So it might look like this:
https://example.io/map?from=1697061600&to=1697752799#7.17/51.23/8.395

The "to" and "from" query parameters show start and end date of the currently set time filter. I want a trigger that fires when the start date of the filter is changed, i.e. the number behind "from=" changes. What I currently have is this: https://imgur.com/a/rsYlotj

But this fires everytime the URL changes. But it should not when another part of the URL changes, e.g. the coordinates at the end, but the "from" paramater stays the same.

Is this possible on GTM and if yes, how?

Posted Oct 19, 2023, 11:57 AM UTC

12

No comments yet

Nobody commented on this post, or the comments weren't captured.