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: http://www.yoyosarecool.com/search/buttons?p=29seejs

 

Can I alter to: http://www.yoyosarecool.com/search?st=buttons&p=29seejs

?

2 REPLIES 2

rewrite current URL before passing

Employee Emeritus

@Michael_Kim_shc

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"];
if(check_something){
  b["my_url"] = b["my_url"] + "/" + b["_pathname1"];
}else{
  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: http://tealium.com/services/education/

 

 

rewrite current URL before passing

Tealium Employee

@Michael_Kim_shc

 

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

 

dom_url_update.png

 

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

 

Adrian

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