# Content tracking is not tracking all elements

**URL:** <https://community.piwik.pro/t/content-tracking-is-not-tracking-all-elements/5030>\
**Category:** Data collection and tags\
**Created:** [March 26, 2025, 11:48am UTC](https://community.piwik.pro/t/content-tracking-is-not-tracking-all-elements/5030 "2025-03-26T11:48:13Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmeekers](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/rmeekers/32/929_2.png) [@rmeekers](https://community.piwik.pro/u/rmeekers)\
**Post date:** [March 26, 2025, 11:48am UTC](https://community.piwik.pro/t/content-tracking-is-not-tracking-all-elements/5030/1 "2025-03-26T11:48:13Z")

</div>

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.

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/7/7d50fb83319b6c774bc2ecd187014162ef785af3.jpeg)

---

<div class="post-metadata">

**Author:** ![gonerator](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/gonerator/32/3549_2.png) [@gonerator](https://community.piwik.pro/u/gonerator)\
**Post date:** [March 26, 2025, 5:20pm UTC](https://community.piwik.pro/t/content-tracking-is-not-tracking-all-elements/5030/2 "2025-03-26T17:20:25Z")

</div>

Hey @rmeekers 🙂

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 😉

---

<div class="post-metadata">

**Author:** ![rmeekers](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/rmeekers/32/929_2.png) [@rmeekers](https://community.piwik.pro/u/rmeekers)\
**Post date:** [May 23, 2025, 2:12pm UTC](https://community.piwik.pro/t/content-tracking-is-not-tracking-all-elements/5030/3 "2025-05-23T14:12:36Z")

</div>

This doesn’t work.  
Even if I execute those functions after the elements are loaded (and tagged with the required attributes) they are not tracked.

---

<div class="post-metadata">

**Author:** ![jfidala](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/jfidala/32/4263_2.png) [@jfidala](https://community.piwik.pro/u/jfidala)\
**Post date:** [May 26, 2025, 1:14pm UTC](https://community.piwik.pro/t/content-tracking-is-not-tracking-all-elements/5030/4 "2025-05-26T13:14:25Z")

</div>

@rmeekers can you send me more details? I can take a look at your instance and check the problem

---

<div class="post-metadata">

**Author:** ![rmeekers](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/rmeekers/32/929_2.png) [@rmeekers](https://community.piwik.pro/u/rmeekers)\
**Post date:** [May 28, 2025, 7:04am UTC](https://community.piwik.pro/t/content-tracking-is-not-tracking-all-elements/5030/5 "2025-05-28T07:04:25Z")

</div>

URL: [Home - United Brands Association](https://www.ubabelgium.be/en/)

 ![Screenshot 2025-05-28 at 08.44.56](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/7/7e0f8b32a91e794d7dcd01a1fd3e1db0067cb3dd.jpeg)

---

<div class="post-metadata">

**Author:** ![jfidala](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/jfidala/32/4263_2.png) [@jfidala](https://community.piwik.pro/u/jfidala)\
**Post date:** [May 30, 2025, 1:07pm UTC](https://community.piwik.pro/t/content-tracking-is-not-tracking-all-elements/5030/6 "2025-05-30T13:07:13Z")

</div>

@rmeekers how are content tracking parameters applied to elements? Are they added in website code?

Have you tried to set element visiblity trigger for submenu and set custom script to track interactions with content there?

---

<div class="post-metadata">

**Author:** ![rmeekers](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/rmeekers/32/929_2.png) [@rmeekers](https://community.piwik.pro/u/rmeekers)\
**Post date:** [May 30, 2025, 2:08pm UTC](https://community.piwik.pro/t/content-tracking-is-not-tracking-all-elements/5030/7 "2025-05-30T14:08:48Z")

</div>

The tracking attributes are added with an event listener.  
And yes. I’ve tried the visibility trigger. Doesn’t work.

---

<div class="post-metadata">

**Author:** ![jfidala](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/jfidala/32/4263_2.png) [@jfidala](https://community.piwik.pro/u/jfidala)\
**Post date:** [June 2, 2025, 12:54pm UTC](https://community.piwik.pro/t/content-tracking-is-not-tracking-all-elements/5030/8 "2025-06-02T12:54:17Z")

</div>

@rmeekers I’ve checked tracker debugger and it seems it’s working for me, can you confirm it’s okay? My visitor ID is `5ac82110a79bcedc`

---

<div class="post-metadata">

**Author:** ![rmeekers](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/rmeekers/32/929_2.png) [@rmeekers](https://community.piwik.pro/u/rmeekers)\
**Post date:** [June 5, 2025, 6:23am UTC](https://community.piwik.pro/t/content-tracking-is-not-tracking-all-elements/5030/9 "2025-06-05T06:23:58Z")

</div>

I don’t see any of the tags in Piwik reporting. All the other items appear perfectly fine.

 ![image.png](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/3/35a58ce8417839b037ab7993d9e629313fd16792.png)

---

<div class="post-metadata">

**Author:** ![jfidala](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/jfidala/32/4263_2.png) [@jfidala](https://community.piwik.pro/u/jfidala)\
**Post date:** [June 5, 2025, 9:01am UTC](https://community.piwik.pro/t/content-tracking-is-not-tracking-all-elements/5030/10 "2025-06-05T09:01:37Z")

</div>

You are right, I’m sorry. I know why I’ve seen it, while testing functions to log all items I must have used some functions to send event in console.

I got one additional idea, try using custom HTML (modify it so it only includes correct object, ie. table object with not tracked elements):

```auto
<script>
var element = document.querySelector("#impressionContainer");  
_paq.push(["trackContentImpressionsWithinNode", element]);
</script>

```

And trigger it with `element visiblity` with CSS selector for submenu, for example:

```auto
#js-mainNavigation > ul > li.nth-child4.layout--50-50.open

```

It’s a bit custom solution, so you have to modify it on your own to match your code.

Here is documentation that might be helpful:

> **[trackContentImpressionsWithinNode](https://developers.piwik.pro/docs/trackcontentimpressionswithinnode)**
>
> The trackContentImpressionsWithinNode() method tracks impressions of a content block in the DOM Node and its children. The content block is an HTML element tagged with the data-track-content attribute or the piwikTrackContent class. Syntax...
