Content tracking is not tracking all elements

I’m using content tracking to track the interactions with my main (mega) menu.
Part of the menu dropdown content is added dynamically when the user intends to open the menu item.
My tracking attributes are added correctly, but the dynamic added elements are not being tracked.

So in this example, the Discover all topics link is present on pageload and tracked correctly. The Agency link is added dynamically and is not tracked.

Hey @rmeekers :slightly_smiling_face:

I haven’t implemented this functionality for a while, but as far as I remember, the solution would be to call

_paq.push(['trackVisibleContentImpressions']);

every time you want the tracker to scan for newly presented content.

If you’re relying on detection of content by it’s DOM elements being tagged, you can also verify if they are actually “visible” for the tracker by executing

_paq.push(["logAllContentBlocksOnPage"]);

My personal preference is to not use the automatic detection and execute both trackContentImpression and trackContentInteraction methods from my own code as content is presented, but of course this is not always possible.

Another way you could achieve that would be using Tag Managers “element visibility” trigger.

I hope this will help you, let me know if you have any questions :wink:

3 Likes