@Srinivasan, @aswaminathan One clarification, based on your post it sounds like you're saying not to use jQuery, but I believe you mean not to use the jQuery OnHandler Extension. Also, when referencing the jQuery object $ within code in Tealium, we recommend using jQuery instead to avoid any collisions with other libraries that may use $ . Also, if the scope of the JavaScript Extension is set to DOM Ready, you do not need to load inside of jQuery(document) .
Lastly, if this is an element that isn't immediately available when the page loads, try using the second code block. I would also give the functions name as it helps with troubleshooting the call stack if there's an error. The extension' s conditions can also help control when and were the code loads. Here are some updated examples.
// jQuery >= v1.7
jQuery("#editEnrollmentCodeButton").on("click", function reviewAppClick() {
utag.link({
"event_category": "Form Analytics-WIQ",
"event_action": "Page_ID (js)",
"event_label": "WIQ-Edit-Enrollment-Code",
"event_name": "Flow_Strategy (js)"
});
});
// Element does not exist on page load
jQuery("body").on("click", "#editEnrollmentCodeButton", function reviewAppClick() {
utag.link({
"event_category": "Form Analytics-WIQ",
"event_action": "Page_ID (js)",
"event_label": "WIQ-Edit-Enrollment-Code",
"event_name": "Flow_Strategy (js)"
});
});
... View more