matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.91k stars 2.65k forks source link

Dynamic loaded content not tracked #18249

Open cdalexndr opened 3 years ago

cdalexndr commented 3 years ago

Expected Behavior

Track content impression/interraction.

Current Behavior

Impression/interraction not tracked.

Possible Solution

Listen DOM changes.

Steps to Reproduce (for Bugs)

  1. Load html using ajax containing a <select data-track-content data-content-name="name" data-content-piece="piece">
  2. Put the loaded html inside an element using Jquery.html() method
  3. After load, there is no network activity to notify content tracking

Note that if I put the select directly in my html it works as expected. Only problem is with dynamic loading.

Context

Your Environment

cdalexndr commented 3 years ago

Found workaround in FAQ

tsteur commented 3 years ago

I'll keep this issue open so we can eventually improve this and detect these elements automatically. Thanks for creating this issue @cdalexndr