jQuery onHandler with SPA condition

Silver Contributor
Silver Contributor

I'm completely stumped with this one. 

From what I can tell, the jQuery onHandler extension can ONLY be scoped to DOM ready.

We use a utag.view() within a SPA and use this to manually update the utag.data["dom.url"] variable, and I can see this updated as I navigate through the SPA.

I was hoping to set a condition on a jQuery click handler for URL containing the fragment from the relevant page. Is my understanding correct that even if utag.data["dom.url"] is showing the correct value when I navigate there, this condition will not work because the jQuery handler only checks it on DOM ready (when it is different)?

How do I get around this? I could set a normal Javascript extension with the same condition and manually code the jQuery in there, but that seems to defeat the purpose of the jQuery handler altogether. I'd like to avoid running the jQuery extension for every page/view in the SPA if at all possible.

Any thoughts would be greatly appreciated.

1 REPLY 1

jQuery onHandler with SPA condition

Tealium Expert
Tealium Expert
@ChrisWallis did you ever figure this out to your satisfaction? I think you're on the right track to create your own JS extension and use page load rules to avoid running the jQuery extension on every page. I feel a Product Idea coming on here - to enhance the jQuery onHandler extension or for someone to explain why it works the way it does.
Tealium Expert
Public