rewrite current URL before passing

Gold Contributor
Gold Contributor

Is there a way to alter the Dom.url variable before passing through to (analytics) tags?

Also - is there a way to limit it to a specific tag, and not all tags?


For instance, if the current url firing the server call is:


Can I alter to:



rewrite current URL before passing

Employee Emeritus


Yes, but for this custom of a solution, you will have to write JavaScript.


There is an extension called Pathname Tokenizer which might get you started.

Then use the JavaScript Extension and make up your own variable.



b["my_url"] = b["dom.url"];
  b["my_url"] = b["my_url"] + "/" + b["_pathname1"];
  b["my_url"] = b["my_url"] + "thing2";

If you scope these extensions to your tag then they will be limited to the tag.  


Also you might be interested in:



rewrite current URL before passing

Tealium Employee



What you can do is have a scoped Set Data Values extension that updates "dom.url". A bit like:




This will only be for that tag, and you will have the update URL available to you.



Ask me anything Tealium related or TypeScript/JavaScript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.