Open cemo opened 7 years ago
That's an interesting idea. I'll have to think about how/whether that could work.
Note that you can kind of do this today with something like the following:
ga('require', 'impressionTracker');
document.addEventListener('DOMContentLoaded', () => {
var elementsWithDataAttributes = Array.from(
document.querySelectorAll('[data-impression-element]'))
.map((el) => el.getAttribute('data-impression-element'));
ga('impressionTracker:observeElements', elementsWithDataAttributes);
});
The current way to start of impression
It would be cool to start automatically these elements based on some data attributes such as
data-impression-element
. These elements can be searched when dom is ready.