gtm-module
gtm-module copied to clipboard
URL manipulation
Hi,
Because of the specific URL format, we're using ( /product/my-awesome-product;123874651287345, where the number after the semicolon is product id) we're facing the issue of stripping down URLs part after semicolon. I'd like to rewrite the URL before pushing to Data Layer so that semicolon is replaced with something more digestible for GA. Is there any option to do that on this module level?
See here. Disable page tracking in the config and create your own implementation of this as a plugin to send whatever data you want.
... Disable page tracking in the config...
This is counterintuitive. I rather expect that gtm
prop could be added on the page with property pageUrl
containing the desired path. This would be a great option for error page in layouts so that it returns something like this pageUrl: `errors/${error.stsatusCode}`
that will group wrong pages nicely.
@KonradDeskiewicz : Have you considered applying filters in the configuration of your GA property? You can do regex-based manipulation of the URLs there.
@matt-jay Indeed striping semicolons through regex is possible at the GTM level. Thanks for the tip. But this is not so straightforward for errors, because in Nuxt errors layout it loaded on errors but URL stays intact, so there is no indication for GTM that error happened. Please check below nuxtRoute
event for a non-existing route: