Highlighted

Create a click handler on dynamically inserted content

We require click tracking clicks on a liveperson.com live chat. Live chat is provided by a script supplied by liveperson.com which dynamically modifies the DOM and inserts the "Live Chat" link into the page. Unfortunately this happens after Tealium loads, so Tealium is unable to find the "Live Chat" link as a Clickhandler Extension. Is there a solution? Thanks
2 REPLIES 2
Highlighted

Create a click handler on dynamically inserted content

Employee Emeritus
Hi Andrew, The new .on Handler extension released very recently (I believe within the past week or so, there's a screenshot below of what this new version looks like) will actually do this now. It's based on the "Direct and delegated events" section of the following link: http://api.jquery.com/on/ Note that this will not work for any elements within an inserted iframe, and it requires jQuery 1.7 or newer. If you tried this very recently and it still does not work, please contact your account manager so we can take a closer look at your specific use-case. Hope this helps!
Highlighted

Create a click handler on dynamically inserted content

Tealium Employee
According to http://api.jquery.com/delegate/ you will need: jQuery( elements ).delegate( selector, events, data, handler ); This is not supported by Tealium so you'll need to do this in a JavaScript extension scoped to DOM Ready, for example: jQuery(body).delegate('#actualselectorhere','onmousedown', function(e) { utag.link({ event_action: 'click' }) });