I am trying to apply Telemetry on my SPA (written in AngularJS). When my SPA is loaded, it initially has a DOM structure similar to:
<html>
<head> ... </head>
<body>
<div id="nav"></div>
<div id="content"></div>
<div id="footer"></div>
</body>
</html>
I am injecting my Telemetry code via Tealium (a 3rd party Tag management software) which is injecting the Telemetry code asynchronously from the Head. The only DOM selectors my Telemetry code will have access to are: #nav, #content, #footer. If I want to track when a user clicks on a CTA, I would have to write something like:
$('#content').on('click', '.module .carousel .cta', function() { ... });
My SPA is fairly large, and I anticipate I will have a few hundred unique items to track. As a result, there will have a few hundred unique $.on() calls made.
My question is if performance will become an issue as each click will have to 'bubble' up to an element right next to <body>
? Is there a better solution for me instead of using only $.on()? Note that I do not have access to the SPA codebase. The only codebase I have access to is in Tealium (which will inject JavaScript onto the SPA).