Is there any way to run an extension (or any custom javascripts) every time when utag.view fires?

Bronze Contributor
Bronze Contributor

I'm working on vue.js based SPA, and sometimes I need to manipulate the DOM on specific pages (views).

If I write a js in an extension, that runs only once. I want to run them every time the user goes to another page of my site without overwriteing the whole utag.view function. (In that case I would lose other setups)

Thank you,
Sam

4 REPLIES 4

Is there any way to run an extension (or any custom javascripts) every time when utag.view fires?

Gold Contributor
Gold Contributor

Hi @tUser_1842 ,

         Yes, extensions can be executed for every call, when you set the scope properly.

If the scope of your extension is in preloader or DOM-ready then the extension will be executed once, because the preloader and dom-ready event will fire when the utag.js library is loaded (Page load).

So to execute the extension for every call (utag.view / utag.link), you can scope the extension to before load rules /after load rules / tag scoped extensions/ after tags. 

If you are using Javascript code extension then there is an option called occurrence, where you can select 'Run Always' to execute the extension on (utag.view / link call). In your case for utag.view, set the condition to fire only on view.

Please refer the below link,

Extension : https://community.tealiumiq.com/t5/iQ-Tag-Management/Extensions/ta-p/13649

Order of Operations : https://community.tealiumiq.com/t5/iQ-Tag-Management/Order-of-Operations/ta-p/326

 

Thanks,

VJ

Its Not Who I am Underneath, but What I Do That Defines Me

Is there any way to run an extension (or any custom javascripts) every time when utag.view fires?

Bronze Contributor
Bronze Contributor

Hi VJ,
Thank you for your advices.

1. I've changed the scope to "Tag scoped extension" and choose a Tag that seems to run on every page re-render (and only once). So it seems to be working now, thank you so much.

2. I also tried to use "After load rules" and "After tag extensions" scope, and set run always but in this case the extension runs several times indeed. I don't find an option to reduce it to utag.view only.

However 1 is working so I'm gonna go with it.

Thanks for your help again,
Sam

Is there any way to run an extension (or any custom javascripts) every time when utag.view fires?

Bronze Contributor
Bronze Contributor

Changing occurence to "Run only once" works well!
Thanks!!

Is there any way to run an extension (or any custom javascripts) every time when utag.view fires?

Bronze Contributor
Bronze Contributor
Hello, how can I get this "only utag.view" condition?
Public